-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Favourite Thumnail #50
Comments
I did it like this. Use the get_user_favorites(); function to bring all the post ids for that user, and store it in a variable. Then do a normal WP_Query, and set that variable as the value for posts__in in the query args. That way you can get anything from those posts that you need, and display it. I agree, it would be nice if this was just built into the functions from the Favorites plugin so you could just do this with the shortcodes, but it is still possible.
|
Hey can you please specify where to put this code? Thank you in advance! |
The code I posted above would go in a template file. Just depends on where you're wanting it to show up. As for displaying the content, yes, you can do that. The method I used is just a standard WP_Query, and once you have the loop setup, you would call the function "the_content()" where you want it to show up, in the same way I called "the_title()" or "the_permalink()". https://codex.wordpress.org/Class_Reference/WP_Query |
Hey thank you so much for the reply..this was my first question here! 1#. In what template file do i add the code? I want the content to show up here. www.trendflix.nl/opgeslagen it is a page not a post. 2#. Can you specify where to put the "the_content()" function. Is it at the "the_title()" or "the_permalink()" or both? Hopefully you can help. Bye! |
Can you please help me a little with my question above? it would mean the world to me and willing to pay you, no problem with paypal.. Thank you. |
WordPress is made up of several php templates: Since you only want the code to show up on that one specific page, you'd need to create a template file for just it. To do this, you'll want to use a Child theme, and copy the parent theme's page.php file, change the filename to page-opgeslagen.php, and then change the code within that file to have the "favorites" code added within, in the position where you need it to show up on the page. the_content() doesn't have to replace the_title() or the_permalink(). It just depends on what you're wanting to show. If you don't want the title or the links to show up, don't use those functions. It does take some basic knowledge of HTML and PHP to work with template files, which you can learn for free here: https://www.codecademy.com/ |
Thank you so much for the reply! You are the man. Im going to try this out. And I will let you know when and if i manage to fix it! I do have two specific questions (again) just to be sure.
Blessings from Amsterdam. |
Hey unfortunately it didn't work. This is what i did: I duplicated "page.php" and renamed one of the two versions to "page-opgeslagen2.php" the original page code looks like this: `<?php
*/ get_header(); ?>
It also gets the footer and div class=row but those just don't show in the code above no matter what i try.....Anyway I started fiddling around by adding your code before and afer the loop closes in the original page code. I also posted it before It does show the No Favorites YetClick on a heart to save a wedding as one of your favorites. <div id="rw-favorites-posts" style="display: none;"></div> removed.
I'm not sure about what to do...And i feel a bit sweaty:P Can you pls help again? Im pretty sure the code affects the right page but it just doesnt show the content (i did put the_content() instead of the_post_thumbnail. Hopefully i hear from you. Cheers! |
The newest release of the plugin includes an additional parameter in the list shortcode to include the post thumbnail, and specify a size. To enable thumbnails, set the [user_favorites user_id="" include_links="true" site_id="" post_types="" include_buttons="false" include_thumbnails="false" thumbnail_size="thumbnail" include_excerpts="false"] I'm going to go ahead and close this issue… getting into specifics about theming may be better served on another platform. |
Thanks Kyle! |
I think personally it would be an awesome idea if you could get the post thumbnail - this is just a suggest and would be pretty awesome.
Say you favourite a blog you can recognize that blog much easier if the thumbnail was there with it :)
The text was updated successfully, but these errors were encountered: