scorxn
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Fixing WordPress
In reply to: evaluate if next_posts_link() will return resultsOn second thought, here’s a better solution:
function dr_previous_posts_link($label = '', $pre = '', $post = '') { ob_start(); previous_posts_link($label); $buffer = ob_get_contents(); ob_end_clean(); if(!empty($buffer)) echo $pre,$buffer,$post; } function dr_next_posts_link($label = '', $pre = '', $post = '') { ob_start(); next_posts_link($label); $buffer = ob_get_contents(); ob_end_clean(); if(!empty($buffer)) echo $pre,$buffer,$post; }Then call them like this:
<?php dr_previous_posts_link('« <i>newer</i>', '<h4 class="posts_nav">', '</h4>'); ?> <?php dr_next_posts_link('<i>older</i> »', '<h4 class="posts_nav">', '</h4>'); ?>Forum: Fixing WordPress
In reply to: evaluate if next_posts_link() will return resultsHere’s my solution. Pretty verbose, but I wanted to avoid the performance overhead of eval();*
function dr_previous_posts_link() { ob_start(); previous_posts_link('« <i>newer</i>'); $buffer = ob_get_contents(); ob_end_clean(); if(!empty($buffer)) echo "<h4 class=\"posts_nav\">$buffer</h4>"; } function dr_next_posts_link() { ob_start(); next_posts_link('» <i>older</i>'); $buffer = ob_get_contents(); ob_end_clean(); if(!empty($buffer)) echo "<h4 class=\"posts_nav\">$buffer</h4>"; }*Using eval(); you could do something like this:
function if_echo($code_string) { ob_start(); eval($code_string); $buffer = ob_get_contents(); ob_end_clean(); if(!empty($buffer)) echo $buffer; }With something like this in a template:
<?php if_echo('next_posts_link()'); ?>Forum: Fixing WordPress
In reply to: Removing Title From Blogroll<?php wp_list_bookmarks('title_li=&categorize=0'); ?>
Viewing 3 replies - 1 through 3 (of 3 total)