WP Favorite Posts
Simply display total number of favourites in header (3 posts)

  1. sunnydriving
    Posted 3 years ago #

    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


  2. sunnydriving
    Posted 3 years ago #

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

  3. sunnydriving
    Posted 3 years ago #

    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.

    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
        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>";
    echo "</ul>";

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Favorite Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.