WordPress.org

Support

Support » Plugins and Hacks » Simply display total number of favourites in header

Simply display total number of favourites in header

  • sunnydriving
    Member

    @sunnydriving

    Please can one of you clever people help with providing the code for:
    displaying a simple count of the total number of favourites that I can display in the header of my site.

    I am currently able to display the count total on a page (and in the widget) but cannot manage to keep the count visible at all times.

    I would provide a link but the site is in dev and the domain is password protected.

    lildragn and Carol were nearly there with what they suggested but not quite.

    Thanks very much to you all in advance

    http://wordpress.org/extend/plugins/wp-favorite-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • sunnydriving
    Member

    @sunnydriving

    the site is anandamedia.net
    and i would like to display the count top-right of the page.

    sunnydriving
    Member

    @sunnydriving

    I am using the following widget code to display a list of favourited posts. All I want to do is display $c permanently in the header. It displays fine as below but only on the wishlist page. when I leave that page, I can’t call the count.

    <?php
    echo "<ul>";
    if ($favorite_post_ids):
    	$c = 0;
    	$favorite_post_ids = array_reverse($favorite_post_ids);
        foreach ($favorite_post_ids as $post_id) {
        	if ($c++ == $limit) break;
            $p = get_post($post_id);?><div class="wishlist-content-list"><?php
            echo $c;
    	echo "<li>";
            echo "<a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> "; ?><br /><?php
    	echo "</li>";?></div><?php
    
        }
    else:
        echo "<li>";
        echo "<i>Your favorites will be listed here. Please browse programs and choose which to add to your Wish List</i>";
        echo "</li>";
    endif;
    echo "</ul>";
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Simply display total number of favourites in header’ is closed to new replies.