Jump to content

PauloCot

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by PauloCot

  1. Here is an image of my comment format: http://oi40.tinypic.com/8w07jt.jpg The hyperlink to each individual comment is the date and time with the url in the format of, for example: /nottingham/#comment-184 After going through my comment templates I found that these two functions do the following, get_comments_link : Retrieves the link to the current post comments AND comments_link: Displays the link to the current post comments The problem is I have no idea where to include these functions so it creates a hyperlink to every comment within every comment. Once this link has been created I'd also like to assign a div to it so I can format it to be in the bottom right corner of each comment. My final goal is to manipulate the link so rather than the comment link itself it will automatically work in the facebook.com/sharer.php which I feel I can do myself once I figure out the previous part. Essentially it will be a share on facebook button, but I have found no plugins which do this yet and thought describing it as a hyperlink would be an easier way to explain what I'm trying to do. Elsewhere I've been told the following: but not sure how to implement this... I hope I've made the question clear, please ask if I haven't. Thanks in advance!
  2. Yes it is for wordpress. What code would be used though? I'm very new to php.
  3. I have two PHP objects if(function_exists('wp_commentnavi')) { wp_commentnavi(); } which is the comment pagination and if(function_exists('wp_commentnavi_all_comments_link')) { wp_commentnavi_all_comments_link(); } which is the all comments link. I would like the second, all the comments link, to be only displayed if a) there are more than x comments OR b) if the comment pagination isn't displayed neither should the all comments link. Essentially I want to say display all comments link if there are more than x comments, if not don't display all comments link. Anyone know the code required to do this? Thanks in advance!
  4. Does anyone have any ideas? I've asked this in multiple locations and had no responses at all. Am I missing something in the question or is it really a complex task?
  5. I am currently using the plugin WP-CommentNavi for comments pagination but whenever a page is clicked it goes to the highest comments page (oldest comments). My comments are purposely displayed newest first and therefore I need the default pagination page to be 1 whenever a link is clicked. I notice there is the same default for other pagination plugins too whereby the highest pagination page (ie if there are 5 pages) page 5 is displayed. At the moment when I load page tellhi####.com/newcastle the page that will be loaded is tellhi####.com/newcastle/comment-page-2/ whereas I want tellhi####.com/newcastle/comment-page-1/ to be loaded I can't be sure this is the relevant code to what I am trying to achieve but I feel the answer might lie in here (below). If not, please tell me and disregard this code. ### Function: Comment Navigation: Boxed Style Paging function wp_commentnavi($before = '', $after = '') { global $wp_query; $comments_per_page = intval(get_query_var('comments_per_page')); $paged = intval(get_query_var('cpage')); $commentnavi_options = get_option('commentnavi_options'); $numcomments = intval($wp_query->comment_count); $max_page = intval($wp_query->max_num_comment_pages); if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = intval($commentnavi_options['num_pages']); $pages_to_show_minus_1 = $pages_to_show-1; $half_page_start = floor($pages_to_show_minus_1/2); $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } if($max_page > 1 || intval($commentnavi_options['always_show']) == 1) { $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $commentnavi_options['pages_text']); $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text); echo $before.'<div class="wp-commentnavi">'."\n"; switch(intval($commentnavi_options['style'])) { case 1: if(!empty($pages_text)) { echo '<span class="pages">'.$pages_text.'</span>'; } if ($start_page >= 2 && $pages_to_show < $max_page) { $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['first_text']); echo '<a href="'.clean_url(get_comments_pagenum_link()).'" class="first" title="'.$first_page_text.'">'.$first_page_text.'</a>'; if(!empty($commentnavi_options['dotleft_text'])) { echo '<span class="extend">'.$commentnavi_options['dotleft_text'].'</span>'; } } previous_comments_link($commentnavi_options['prev_text']); for($i = $start_page; $i <= $end_page; $i++) { if($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']); echo '<span class="current">'.$current_page_text.'</span>'; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']); echo '<a href="'.clean_url(get_comments_pagenum_link($i)).'" class="page" title="'.$page_text.'">'.$page_text.'</a>'; } } next_comments_link($commentnavi_options['next_text'], $max_page); if ($end_page < $max_page) { if(!empty($commentnavi_options['dotright_text'])) { echo '<span class="extend">'.$commentnavi_options['dotright_text'].'</span>'; } $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['last_text']); echo '<a href="'.clean_url(get_comments_pagenum_link($max_page)).'" class="last" title="'.$last_page_text.'">'.$last_page_text.'</a>'; } break; case 2; echo '<form action="'.admin_url('admin.php?page='.plugin_basename(__FILE__)).'" method="get">'."\n"; echo '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n"; for($i = 1; $i <= $max_page; $i++) { $page_num = $i; if($page_num == 1) { $page_num = 0; } if($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']); echo '<option value="'.clean_url(get_comments_pagenum_link($page_num)).'" selected="selected" class="current">'.$current_page_text."</option>\n"; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']); echo '<option value="'.clean_url(get_comments_pagenum_link($page_num)).'">'.$page_text."</option>\n"; } } echo "</select>\n"; echo "</form>\n"; break; } echo '</div>'.$after."\n"; } } In short I need, anytime a page is clicked, for the comments pagination to be on page 1, not the highest page available. Just so you know I have tried the discussion settings on the wordpress dashboard. Nothing on google either! Failing a full answer, does anyone know the actual php code that determines what pagination page is loaded by default? I received this response via an e-mail but due to my PHP knowledge am unable to implement it, any ideas? ... Just reverse the loop. That'll fix it. Here's the relevant part: http://pastie.org/8166399 You need to go back, i.e. use $i-- Hope I have been clear in my question! Thanks in advance, Paul
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.