![]() When I pull content from another page on my WordPress sites, I avoid using get_post() in favour of declaring a fresh new WP_Query() (that's just my preference), following it up with a wp_reset_postdata() declaration. However, I can point you in the right direction for the solution. Place, the code snippets are less than ideal regarding their readability, etc.). Now, the code in your pastebin is a pretty massive dog's breakfast, so a direct solution is a rather large undertaking (e.g. The key reason why your post values are being overwritten, the additional get_post() declarations are overriding the default query. Here is also a video tutorial on post formats from Traversy media That way I have 2 different post types on one page Inside functions.php I activated the post-formats inside wp_theme_setup() function add_theme_support('post-formats', array('aside', 'gallery')) I, myself use get_post_format() so it can be styled differently or have different options. I may be wrong, but it seems to me that you are trying to post a different post format with normal post format? Returns the $main_p post id and not the main post of the single.php Then I am trying to use the variable $post OR the_title() OR any other functions to get the first post and it always returning the info of the $main_p postįor example get_the_title( get_post()->ID ) Real-World Example: How to Display a Custom List of Items With a Shortcode.Why get_posts is Limited to 5 WordPress Posts?.Want to know how we increased our traffic over 1000%?.How To Build Advanced Queries in WordPress.How To Use Parameters to Build Simple Queries.How to Build Queries With WordPress get_posts.Introduction to the WordPress get_posts Function.Not the answer you're looking for? Browse other questions taggedĬustom-wordpress-pages or ask your own question. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |