Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter zhirkovski

    (@zhirkovski)

    found the answer in this git gist

    @zhirkovski Did you get the code to work in a template file? For some reason I can’t get it to run properly… just returns everything. Could you post your working template code?

    I found the git gist but I couldn’t implement it. Can someone point to some direction?

    The git gist is incomplete. It sets up the loop, does not implement the loop.

    Comment out Method 1. in Method 2, where it say:

    // Treat this like any other WP loop

    change this line to

    echo get_the_title() ;

    Then when this function is called it will display a list of titles. Google info on the WordPress loop for more complex displays involving thumbnails, links, etc.

    I happen to be using WooCommerce so I am integrating a Favorites list into my Woo generated User Profile page. My whole setup looks like this:

    1. I copied the git gist to a file called mytheme/favorites-display.php.

    2. I added html for a section header <h2> and other markup, and edit the loop to make a nice list. I’ll probably do stars and titles with links; the stars will allow the items to be un-favorited.

    3. I added this line to themes/mytheme/woocommerce/myaccount/my-account.php:

    <?php wc_get_template( '../favorites-display.php' ); ?>

    Now on my Woocommerce profile page I will see a list of favorites above my WooCommerce shipping and billing addresses and recent orders.

    This gist was so helpful. Thank you zhirkovski for sharing it. Saved the day.

    Thanks slamorte, that pushed me in the right direction. I had to close all the git gist code in php and then I could just basically copy over my single.php code that structures my posts. Now all my favorite posts show up exactly like they do on a single post page with thumbnails and all.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Display user's favorited posts’ is closed to new replies.