Parse error: syntax error, unexpected T_STRING in /home/content/
Résolu
ooliver4
Messages postés
1
Date d'inscription
Statut
Membre
Dernière intervention
-
ooliver4 -
ooliver4 -
Bonjour à tous,
Je viens vers vous car, après une mauvaise manipulation (certainement), je me retrouve avec ce message d'erreur:
Parse error: syntax error, unexpected T_STRING in /home/content/94/11513494/html/wp-content/themes/primetime/widgets/widget-news-combine.php on line 196
Le code est:
<?php
/**
* Add function to widgets_init that will load our widget.
*/
add_action( 'widgets_init', 'news_combine_load_widgets' );
/**
* Register our widget.
*/
function news_combine_load_widgets() {
register_widget('news_combine_widget');
}
/**
* News Combine Widget class.
*/
class news_combine_widget extends WP_Widget {
/**
* Widget setup.
*/
function news_combine_widget() {
/* Widget settings. */
$widget_ops = array('classname' => 'widget_news_combine', 'description' => __('Show recent & popular & most commented news', 'wpspace'));
/* Widget control settings. */
$control_ops = array('width' => 200, 'height' => 250, 'id_base' => 'news-combine-widget');
/* Create the widget. */
$this->WP_Widget('news-combine-widget', __('RM - News Combine', 'wpspace'), $widget_ops, $control_ops);
}
/**
* How to display the widget on the screen.
*/
function widget($args, $instance) {
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
$subtitle = apply_filters('widget_subtitle', isset($instance['subtitle']) ? $instance['subtitle'] : '');
$countposts = isset($instance['number']) ? ($instance['number'] < 1 ? 7 : $instance['number']) : 7;
$userecent = isset($instance['userecent']) ? $instance['userecent'] : '';
$usepopular = isset($instance['usepopular']) ? $instance['usepopular'] : '';
$usecomment = isset($instance['usecommented']) ? $instance['usecommented'] : '';
$color = isset($instance['color']) ? $instance['color'] : '';
$blocks = 0;
$output = '
<div class="widget_header' . ($color ? ' '.$color : '') . '">
';
/* Checking for already used posts stream page */
if ($subtitle) {
global $wpdb;
$posts_page_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_value='template-news.php' LIMIT 0,1");
if ($posts_page_id) {
$posts_page_link = get_permalink($posts_page_id);
$output .= '<div class="widget_subtitle"><a href="'.$posts_page_link.'" class="lnk_all_news">'.$subtitle.'</a></div>';
}
}
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) $output .= $before_title . $title . $after_title;
$output .= '
</div>
<div class="widget_body">
';
global $wpdb, $shortname;
$blog_page_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_value='template-blog-one.php'");
$blog_page_link = get_permalink($blog_page_id);
$usepopular_output = $postspopular_output = '';
if ($usepopular == 1) {
$usepopular_output = ' <li><a href="#2"><span>'.__('Popular', 'wpspace').'</span></a></li><!-- tab link -->';
////$sql = 'select DISTINCT * from '.$wpdb->posts.'
// WHERE '.$wpdb->posts.'.post_status="publish"
// AND '.$wpdb->posts.'.post_type="news"
// GROUP BY ID
// ORDER BY '.$wpdb->posts.'.comment_count DESC
// LIMIT 0,'.$countposts;
$sql = 'select p.*, m.meta_key, CAST(m.meta_value AS UNSIGNED) as counter
from '.$wpdb->posts.' as p
left join wp_postmeta as m on p.id=m.post_id
WHERE p.post_status="publish"
AND p.post_type="news"
AND m.meta_key="post_views_count"
ORDER BY counter DESC
LIMIT 0,' .$countposts;
$posts = $wpdb->get_results($sql);
$postspopular_output = '
<div class="tab_content">
<!-- tab content goes here -->
';
$post_number = 0;
foreach ($posts as $post) {
$hot_news = "";
$is_hot = get_post_meta($post->ID, 'custom_is_hot');
if(isset($is_hot[0]) && $is_hot[0] == 'on') $hot_news = '<span class="hot">Hot!</span>';
$post_number++;
//get comments number for each post
$num_comments = 0;
$num_comments = get_comments_number($post->ID);
if ( comments_open() ) {
if($num_comments == 0) {
$comments = 0;
} elseif($num_comments > 1) {
$comments = $num_comments;
} else {
$comments = 1;
}
$write_comments = $comments;
} else { $write_comments = 0; }
$post_title = $post->post_title;
$post_date_gmt = date("H:i",strtotime($post->post_date_gmt));
$views_count_output = '';
$custom_post_type = get_post_type($post->ID);
if (get_option($shortname.'_blog_post_views') == 'true') {
$views_count_output = '<a href="'.get_permalink($post->ID).'" class="views">'.getPostViews($post->ID).'</a>';
}
$postspopular_output .= '
<div class="block_home_news_post">
<div class="info">
<div class="date">'.$post_date_gmt.'</div>
</div>
<p class="title"><a href="'.get_permalink($post->ID).'">'.$hot_news.$post_title.'</a></p>
</div>
';
}
if ($blog_page_id) {
$postspopular_output .= '
<div class="separator" style="height:7px;"></div>
<a href="'.$blog_page_link.'" class="lnk_all_news fl">'.__('All Posts','wpspace').'</a>
<div class="clearboth"></div>
';
}
$postspopular_output .= '</div>';
if ($post_number > 0) $blocks++;
}
$userecent_output = $blogposts_output = '';
if ($userecent == 1) {
$userecent_output = '<li><a href="#1" class="current"><span>'.__('Latest','wpspace').'</span></a></li><!-- tab link -->';
$sql = 'select DISTINCT * from '.$wpdb->posts.'
WHERE '.$wpdb->posts.'.post_status="publish"
AND '.$wpdb->posts.'.post_type="news"
GROUP BY ID
ORDER BY '.$wpdb->posts.'.post_date DESC
LIMIT 0,'.$countposts;
$posts = $wpdb->get_results($sql);
$blogposts_output = '
<div class="tab_content" id="1">
<!-- tab content goes here -->
';
$post_number = 0;
foreach ($posts as $post) {
$hot_news = "";
$is_hot = get_post_meta($post->ID, 'custom_is_hot');
if(isset($is_hot[0]) && $is_hot[0] == 'on') $hot_news = '<span class="hot">Hot!</span>';
$post_number++;
//get comments number for each post
$num_comments = 0;
$num_comments = get_comments_number($post->ID);
if ( comments_open() ) {
if($num_comments == 0) {
$comments = 0;
} elseif($num_comments > 1) {
$comments = $num_comments;
} else {
$comments = 1;
}
$write_comments = $comments;
} else { $write_comments = 0; }
$post_title = $post->post_title;
//$image_url = get_ the_post_thumbnail($post->ID, 'recent_blogs_flickr');
$post_date_gmt = date("H:i",strtotime($post->post_date_gmt));
$views_count_output = '';
$custom_post_type = get_post_type($post->ID);
if (get_option($shortname.'_blog_post_views') == 'true') {
$views_count_output = '<a href="'.get_permalink($post->ID).'" class="views">'.getPostViews($post->ID).'</a>';
}
$blogposts_output .= '
<div class="block_home_news_post">
<div class="info">
<div class="date">'.$post_date_gmt.'</div>
</div>
<p class="title"><a href="'.get_permalink($post->ID).'">'.$hot_news.$post_title.'</a></p>
</div>
';
}
if ($blog_page_id) {
$blogposts_output .= '
<div class="separator" style="height:7px;"></div>
<a href="'.$blog_page_link.'" class="lnk_all_news fl">'.__('All Posts','wpspace').'</a>
<div class="clearboth"></div>
';
}
$blogposts_output .= '</div>';
if ($post_number > 0) $blocks++;
}
$usecomment_output = $commented_output = '';
if ($usecomment == 1) {
$usecomment_output = '<li><a href="#3"><span>'.__('Most Commented','wpspace').'</span></a></li><!-- tab link -->';
$sql = 'select DISTINCT * from '.$wpdb->posts.'
WHERE '.$wpdb->posts.'.post_status="publish"
AND '.$wpdb->posts.'.post_type="news"
GROUP BY ID
ORDER BY '.$wpdb->posts.'.comment_count DESC
LIMIT 0,'.$countposts;
$posts = $wpdb->get_results($sql);
$commented_output = '
<div class="tab_content" id="2">
<!-- tab content goes here -->
';
$post_number = 0;
foreach ($posts as $post) {
$hot_news = "";
$is_hot = get_post_meta($post->ID, 'custom_is_hot');
if(isset($is_hot[0]) && $is_hot[0] == 'on') $hot_news = '<span class="hot">Hot!</span>';
$post_number++;
//get comments number for each post
$num_comments = 0;
$num_comments = get_comments_number($post->ID);
if ( comments_open() ) {
if($num_comments == 0) {
$comments = 0;
} elseif($num_comments > 1) {
$comments = $num_comments;
} else {
$comments = 1;
}
$write_comments = $comments;
} else { $write_comments = 0; }
$post_title = $post->post_title;
//$image_url = get_ the_post_thumbnail($post->ID, 'recent_blogs_flickr');
$post_date_gmt = date("H:i",strtotime($post->post_date_gmt));
$views_count_output = '';
$custom_post_type = get_post_type($post->ID);
if (get_option($shortname.'_blog_post_views') == 'true') {
$views_count_output = '<a href="'.get_permalink($post->ID).'" class="views">'.getPostViews($post->ID).'</a>';
}
$commented_output .= '
<div class="block_home_news_post">
<div class="info">
<div class="date">'.$post_date_gmt.'</div>
</div>
<p class="title"><a href="'.get_permalink($post->ID).'">'.$hot_news.$post_title.'</a></p>
</div>
';
}
if ($blog_page_id) {
$commented_output .= '
<div class="separator" style="height:7px;"></div>
<a href="'.$blog_page_link.'" class="lnk_all_news fl">'.__('All Posts','wpspace').'</a>
<div class="clearboth"></div>
';
}
$commented_output .= '</div>';
if ($post_number > 0) $blocks++;
}
$output .= '
<div class="block_news_tabs">
';
if ($blocks > 1)
$output .= '
<div class="tabs">
<ul>
'.$userecent_output.'
'.$usepopular_output.'
'.$usecomment_output.'
</ul>
</div>
';
$output .=
$blogposts_output . '
' . $postspopular_output . '
' . $commented_output;
if ($blocks > 1)
$output .= '
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'.block_news_tabs\').tabs(\'div.tab_content\', {
tabs: \'div.tabs a\',
initialIndex: 0
});
});
</script>';
$output .= '
</div>
';
$output .= '
</div>
';
if ($blocks > 0) {
/* Before widget (defined by themes). */
echo $before_widget;
echo $output;
/* After widget (defined by themes). */
echo $after_widget;
}
}
/**
* Update the widget settings.
*/
function update($new_instance, $old_instance) {
$instance = $old_instance;
/* Strip tags for title and comments count to remove HTML (important for text inputs). */
$instance['title'] = strip_tags($new_instance['title']);
$instance['subtitle'] = strip_tags($new_instance['subtitle']);
$instance['number'] = strip_tags($new_instance['number']);
$instance['userecent'] = isset($new_instance['userecent']) ? 1 : 0;
$instance['usepopular'] = isset($new_instance['usepopular']) ? 1 : 0;
$instance['usecommented'] = isset($new_instance['usecommented']) ? 1 : 0;
$instance['color'] = strip_tags( $new_instance['color'] );
return $instance;
}
/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* when creating your form elements. This handles the confusing stuff.
*/
function form($instance) {
/* Set up some default widget settings. */
$defaults = array('title' => '', 'subtitle' => '', 'number' => '7', 'userecent' => '1', 'usepopular' => '1', 'usecommented' => '1', 'description' => __('Recent & Popular & Most Commented News', 'wpspace'));
$instance = wp_parse_args((array) $instance, $defaults);
$title = isset($instance['title']) ? $instance['title'] : '';
$subtitle = isset($instance['subtitle']) ? $instance['subtitle'] : '';
$number = isset($instance['number']) ? $instance['number'] : '';
$userecent = isset($instance['userecent']) ? $instance['userecent'] : '';
$usepopular = isset($instance['usepopular']) ? $instance['usepopular'] : '';
$usecommented = isset($instance['usecommented']) ? $instance['usecommented'] : '';
$color = isset($instance['color']) ? $instance['color'] : '';
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'wpspace'); ?></label>
<input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo $this->get_field_id('subtitle'); ?>"><?php _e('Subtitle:', 'wpspace'); ?></label>
<input id="<?php echo $this->get_field_id('subtitle'); ?>" name="<?php echo $this->get_field_name('subtitle'); ?>" value="<?php echo $subtitle; ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Count news on each tab:', 'wpspace'); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" value="<?php echo $number; ?>" style="width:100%;" />
</p>
<p>
<input id="<?php echo $this->get_field_id('userecent'); ?>" name="<?php echo $this->get_field_name('userecent'); ?>" value="1" type="checkbox" <?php echo $userecent==1 ? 'checked="cheched"' : ''; ?> />
<label for="<?php echo $this->get_field_id('userecent'); ?>"><?php _e('Show recent news', 'wpspace'); ?></label>
</p>
<p>
<input id="<?php echo $this->get_field_id('usepopular'); ?>" name="<?php echo $this->get_field_name('usepopular'); ?>" value="1" type="checkbox" <?php echo $usepopular==1 ? 'checked="cheched"' : ''; ?> />
<label for="<?php echo $this->get_field_id('usepopular'); ?>"><?php _e('Show popular news', 'wpspace'); ?></label><br />
</p>
<p>
<input id="<?php echo $this->get_field_id('usecommented'); ?>" name="<?php echo $this->get_field_name('usecommented'); ?>" value="1" type="checkbox" <?php echo $usecommented==1 ? 'checked="cheched"' : ''; ?> />
<label for="<?php echo $this->get_field_id('usecommented'); ?>"><?php _e('Show most commented news', 'wpspace'); ?></label><br />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'color' ); ?>"><?php _e('Widget title background:', 'wpspace'); ?></label>
<?php showColorsList($this->get_field_id( 'color' ), $this->get_field_name( 'color' ), $color); ?>
</p>
<?php
}
}
?>
Je vous remercie d'avance pour votre temps.
Olivier
Je viens vers vous car, après une mauvaise manipulation (certainement), je me retrouve avec ce message d'erreur:
Parse error: syntax error, unexpected T_STRING in /home/content/94/11513494/html/wp-content/themes/primetime/widgets/widget-news-combine.php on line 196
Le code est:
<?php
/**
* Add function to widgets_init that will load our widget.
*/
add_action( 'widgets_init', 'news_combine_load_widgets' );
/**
* Register our widget.
*/
function news_combine_load_widgets() {
register_widget('news_combine_widget');
}
/**
* News Combine Widget class.
*/
class news_combine_widget extends WP_Widget {
/**
* Widget setup.
*/
function news_combine_widget() {
/* Widget settings. */
$widget_ops = array('classname' => 'widget_news_combine', 'description' => __('Show recent & popular & most commented news', 'wpspace'));
/* Widget control settings. */
$control_ops = array('width' => 200, 'height' => 250, 'id_base' => 'news-combine-widget');
/* Create the widget. */
$this->WP_Widget('news-combine-widget', __('RM - News Combine', 'wpspace'), $widget_ops, $control_ops);
}
/**
* How to display the widget on the screen.
*/
function widget($args, $instance) {
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
$subtitle = apply_filters('widget_subtitle', isset($instance['subtitle']) ? $instance['subtitle'] : '');
$countposts = isset($instance['number']) ? ($instance['number'] < 1 ? 7 : $instance['number']) : 7;
$userecent = isset($instance['userecent']) ? $instance['userecent'] : '';
$usepopular = isset($instance['usepopular']) ? $instance['usepopular'] : '';
$usecomment = isset($instance['usecommented']) ? $instance['usecommented'] : '';
$color = isset($instance['color']) ? $instance['color'] : '';
$blocks = 0;
$output = '
<div class="widget_header' . ($color ? ' '.$color : '') . '">
';
/* Checking for already used posts stream page */
if ($subtitle) {
global $wpdb;
$posts_page_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_value='template-news.php' LIMIT 0,1");
if ($posts_page_id) {
$posts_page_link = get_permalink($posts_page_id);
$output .= '<div class="widget_subtitle"><a href="'.$posts_page_link.'" class="lnk_all_news">'.$subtitle.'</a></div>';
}
}
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) $output .= $before_title . $title . $after_title;
$output .= '
</div>
<div class="widget_body">
';
global $wpdb, $shortname;
$blog_page_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_value='template-blog-one.php'");
$blog_page_link = get_permalink($blog_page_id);
$usepopular_output = $postspopular_output = '';
if ($usepopular == 1) {
$usepopular_output = ' <li><a href="#2"><span>'.__('Popular', 'wpspace').'</span></a></li><!-- tab link -->';
////$sql = 'select DISTINCT * from '.$wpdb->posts.'
// WHERE '.$wpdb->posts.'.post_status="publish"
// AND '.$wpdb->posts.'.post_type="news"
// GROUP BY ID
// ORDER BY '.$wpdb->posts.'.comment_count DESC
// LIMIT 0,'.$countposts;
$sql = 'select p.*, m.meta_key, CAST(m.meta_value AS UNSIGNED) as counter
from '.$wpdb->posts.' as p
left join wp_postmeta as m on p.id=m.post_id
WHERE p.post_status="publish"
AND p.post_type="news"
AND m.meta_key="post_views_count"
ORDER BY counter DESC
LIMIT 0,' .$countposts;
$posts = $wpdb->get_results($sql);
$postspopular_output = '
<div class="tab_content">
<!-- tab content goes here -->
';
$post_number = 0;
foreach ($posts as $post) {
$hot_news = "";
$is_hot = get_post_meta($post->ID, 'custom_is_hot');
if(isset($is_hot[0]) && $is_hot[0] == 'on') $hot_news = '<span class="hot">Hot!</span>';
$post_number++;
//get comments number for each post
$num_comments = 0;
$num_comments = get_comments_number($post->ID);
if ( comments_open() ) {
if($num_comments == 0) {
$comments = 0;
} elseif($num_comments > 1) {
$comments = $num_comments;
} else {
$comments = 1;
}
$write_comments = $comments;
} else { $write_comments = 0; }
$post_title = $post->post_title;
$post_date_gmt = date("H:i",strtotime($post->post_date_gmt));
$views_count_output = '';
$custom_post_type = get_post_type($post->ID);
if (get_option($shortname.'_blog_post_views') == 'true') {
$views_count_output = '<a href="'.get_permalink($post->ID).'" class="views">'.getPostViews($post->ID).'</a>';
}
$postspopular_output .= '
<div class="block_home_news_post">
<div class="info">
<div class="date">'.$post_date_gmt.'</div>
</div>
<p class="title"><a href="'.get_permalink($post->ID).'">'.$hot_news.$post_title.'</a></p>
</div>
';
}
if ($blog_page_id) {
$postspopular_output .= '
<div class="separator" style="height:7px;"></div>
<a href="'.$blog_page_link.'" class="lnk_all_news fl">'.__('All Posts','wpspace').'</a>
<div class="clearboth"></div>
';
}
$postspopular_output .= '</div>';
if ($post_number > 0) $blocks++;
}
$userecent_output = $blogposts_output = '';
if ($userecent == 1) {
$userecent_output = '<li><a href="#1" class="current"><span>'.__('Latest','wpspace').'</span></a></li><!-- tab link -->';
$sql = 'select DISTINCT * from '.$wpdb->posts.'
WHERE '.$wpdb->posts.'.post_status="publish"
AND '.$wpdb->posts.'.post_type="news"
GROUP BY ID
ORDER BY '.$wpdb->posts.'.post_date DESC
LIMIT 0,'.$countposts;
$posts = $wpdb->get_results($sql);
$blogposts_output = '
<div class="tab_content" id="1">
<!-- tab content goes here -->
';
$post_number = 0;
foreach ($posts as $post) {
$hot_news = "";
$is_hot = get_post_meta($post->ID, 'custom_is_hot');
if(isset($is_hot[0]) && $is_hot[0] == 'on') $hot_news = '<span class="hot">Hot!</span>';
$post_number++;
//get comments number for each post
$num_comments = 0;
$num_comments = get_comments_number($post->ID);
if ( comments_open() ) {
if($num_comments == 0) {
$comments = 0;
} elseif($num_comments > 1) {
$comments = $num_comments;
} else {
$comments = 1;
}
$write_comments = $comments;
} else { $write_comments = 0; }
$post_title = $post->post_title;
//$image_url = get_ the_post_thumbnail($post->ID, 'recent_blogs_flickr');
$post_date_gmt = date("H:i",strtotime($post->post_date_gmt));
$views_count_output = '';
$custom_post_type = get_post_type($post->ID);
if (get_option($shortname.'_blog_post_views') == 'true') {
$views_count_output = '<a href="'.get_permalink($post->ID).'" class="views">'.getPostViews($post->ID).'</a>';
}
$blogposts_output .= '
<div class="block_home_news_post">
<div class="info">
<div class="date">'.$post_date_gmt.'</div>
</div>
<p class="title"><a href="'.get_permalink($post->ID).'">'.$hot_news.$post_title.'</a></p>
</div>
';
}
if ($blog_page_id) {
$blogposts_output .= '
<div class="separator" style="height:7px;"></div>
<a href="'.$blog_page_link.'" class="lnk_all_news fl">'.__('All Posts','wpspace').'</a>
<div class="clearboth"></div>
';
}
$blogposts_output .= '</div>';
if ($post_number > 0) $blocks++;
}
$usecomment_output = $commented_output = '';
if ($usecomment == 1) {
$usecomment_output = '<li><a href="#3"><span>'.__('Most Commented','wpspace').'</span></a></li><!-- tab link -->';
$sql = 'select DISTINCT * from '.$wpdb->posts.'
WHERE '.$wpdb->posts.'.post_status="publish"
AND '.$wpdb->posts.'.post_type="news"
GROUP BY ID
ORDER BY '.$wpdb->posts.'.comment_count DESC
LIMIT 0,'.$countposts;
$posts = $wpdb->get_results($sql);
$commented_output = '
<div class="tab_content" id="2">
<!-- tab content goes here -->
';
$post_number = 0;
foreach ($posts as $post) {
$hot_news = "";
$is_hot = get_post_meta($post->ID, 'custom_is_hot');
if(isset($is_hot[0]) && $is_hot[0] == 'on') $hot_news = '<span class="hot">Hot!</span>';
$post_number++;
//get comments number for each post
$num_comments = 0;
$num_comments = get_comments_number($post->ID);
if ( comments_open() ) {
if($num_comments == 0) {
$comments = 0;
} elseif($num_comments > 1) {
$comments = $num_comments;
} else {
$comments = 1;
}
$write_comments = $comments;
} else { $write_comments = 0; }
$post_title = $post->post_title;
//$image_url = get_ the_post_thumbnail($post->ID, 'recent_blogs_flickr');
$post_date_gmt = date("H:i",strtotime($post->post_date_gmt));
$views_count_output = '';
$custom_post_type = get_post_type($post->ID);
if (get_option($shortname.'_blog_post_views') == 'true') {
$views_count_output = '<a href="'.get_permalink($post->ID).'" class="views">'.getPostViews($post->ID).'</a>';
}
$commented_output .= '
<div class="block_home_news_post">
<div class="info">
<div class="date">'.$post_date_gmt.'</div>
</div>
<p class="title"><a href="'.get_permalink($post->ID).'">'.$hot_news.$post_title.'</a></p>
</div>
';
}
if ($blog_page_id) {
$commented_output .= '
<div class="separator" style="height:7px;"></div>
<a href="'.$blog_page_link.'" class="lnk_all_news fl">'.__('All Posts','wpspace').'</a>
<div class="clearboth"></div>
';
}
$commented_output .= '</div>';
if ($post_number > 0) $blocks++;
}
$output .= '
<div class="block_news_tabs">
';
if ($blocks > 1)
$output .= '
<div class="tabs">
<ul>
'.$userecent_output.'
'.$usepopular_output.'
'.$usecomment_output.'
</ul>
</div>
';
$output .=
$blogposts_output . '
' . $postspopular_output . '
' . $commented_output;
if ($blocks > 1)
$output .= '
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'.block_news_tabs\').tabs(\'div.tab_content\', {
tabs: \'div.tabs a\',
initialIndex: 0
});
});
</script>';
$output .= '
</div>
';
$output .= '
</div>
';
if ($blocks > 0) {
/* Before widget (defined by themes). */
echo $before_widget;
echo $output;
/* After widget (defined by themes). */
echo $after_widget;
}
}
/**
* Update the widget settings.
*/
function update($new_instance, $old_instance) {
$instance = $old_instance;
/* Strip tags for title and comments count to remove HTML (important for text inputs). */
$instance['title'] = strip_tags($new_instance['title']);
$instance['subtitle'] = strip_tags($new_instance['subtitle']);
$instance['number'] = strip_tags($new_instance['number']);
$instance['userecent'] = isset($new_instance['userecent']) ? 1 : 0;
$instance['usepopular'] = isset($new_instance['usepopular']) ? 1 : 0;
$instance['usecommented'] = isset($new_instance['usecommented']) ? 1 : 0;
$instance['color'] = strip_tags( $new_instance['color'] );
return $instance;
}
/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* when creating your form elements. This handles the confusing stuff.
*/
function form($instance) {
/* Set up some default widget settings. */
$defaults = array('title' => '', 'subtitle' => '', 'number' => '7', 'userecent' => '1', 'usepopular' => '1', 'usecommented' => '1', 'description' => __('Recent & Popular & Most Commented News', 'wpspace'));
$instance = wp_parse_args((array) $instance, $defaults);
$title = isset($instance['title']) ? $instance['title'] : '';
$subtitle = isset($instance['subtitle']) ? $instance['subtitle'] : '';
$number = isset($instance['number']) ? $instance['number'] : '';
$userecent = isset($instance['userecent']) ? $instance['userecent'] : '';
$usepopular = isset($instance['usepopular']) ? $instance['usepopular'] : '';
$usecommented = isset($instance['usecommented']) ? $instance['usecommented'] : '';
$color = isset($instance['color']) ? $instance['color'] : '';
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'wpspace'); ?></label>
<input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo $this->get_field_id('subtitle'); ?>"><?php _e('Subtitle:', 'wpspace'); ?></label>
<input id="<?php echo $this->get_field_id('subtitle'); ?>" name="<?php echo $this->get_field_name('subtitle'); ?>" value="<?php echo $subtitle; ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Count news on each tab:', 'wpspace'); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" value="<?php echo $number; ?>" style="width:100%;" />
</p>
<p>
<input id="<?php echo $this->get_field_id('userecent'); ?>" name="<?php echo $this->get_field_name('userecent'); ?>" value="1" type="checkbox" <?php echo $userecent==1 ? 'checked="cheched"' : ''; ?> />
<label for="<?php echo $this->get_field_id('userecent'); ?>"><?php _e('Show recent news', 'wpspace'); ?></label>
</p>
<p>
<input id="<?php echo $this->get_field_id('usepopular'); ?>" name="<?php echo $this->get_field_name('usepopular'); ?>" value="1" type="checkbox" <?php echo $usepopular==1 ? 'checked="cheched"' : ''; ?> />
<label for="<?php echo $this->get_field_id('usepopular'); ?>"><?php _e('Show popular news', 'wpspace'); ?></label><br />
</p>
<p>
<input id="<?php echo $this->get_field_id('usecommented'); ?>" name="<?php echo $this->get_field_name('usecommented'); ?>" value="1" type="checkbox" <?php echo $usecommented==1 ? 'checked="cheched"' : ''; ?> />
<label for="<?php echo $this->get_field_id('usecommented'); ?>"><?php _e('Show most commented news', 'wpspace'); ?></label><br />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'color' ); ?>"><?php _e('Widget title background:', 'wpspace'); ?></label>
<?php showColorsList($this->get_field_id( 'color' ), $this->get_field_name( 'color' ), $color); ?>
</p>
<?php
}
}
?>
Je vous remercie d'avance pour votre temps.
Olivier
A voir également:
- Parse error: syntax error, unexpected T_STRING in /home/content/
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- Playback error reconnect in 3s (1/5) francais - Forum Box et Streaming vidéo
- Error 1962 ✓ - Forum PC fixe
- Whea error occt - Forum Processeur
- A javascript error occurred in the main process - Forum Matériel & Système
1 réponse
Bonsoir
Il n'y a pas d'erreur syntax error, unexpected T_STRING dans le code que tu as donné.
Es-tu sûr de nous donner le bon fichier ? Est-ce bien celui de ton serveur que tu nous montres, ou une copie ?
Si tu es bien sûr de tout ça, il s'agit peut-être d'un caractère invisible qui n'est pas recopié sur CCM. Peux-tu mettre le fichier sur cjoint.com (ou autre) et mettre le lien ici ?
Il n'y a pas d'erreur syntax error, unexpected T_STRING dans le code que tu as donné.
Es-tu sûr de nous donner le bon fichier ? Est-ce bien celui de ton serveur que tu nous montres, ou une copie ?
Si tu es bien sûr de tout ça, il s'agit peut-être d'un caractère invisible qui n'est pas recopié sur CCM. Peux-tu mettre le fichier sur cjoint.com (ou autre) et mettre le lien ici ?
J'ai finalement trouvé la cause du problème, c'était tout bête.
Il n'y a effectivement pas d'erreur.
J'avais effectué une modif du code php via l'éditeur du back office du site wordpress d'un ami. J'ai certainement fait une erreur avant de valider. L'éditeur a dû enregistrer le code erroné mais me renvoyait toujours sur celui que j'ai posté, donc juste.
A ce moment là, je n'avais pas encore les codes ftp. Mais je les ai récupérés et j'ai donc pu vérifier que l'erreur avait bien été enregistré.
Voilà, tout va bien. Je ne sais pas si tu as compris mes explications, j'ai essayé de faire le plus clair possible.
Toutes mes excuses et merci.