Variable not working in sidebar loop
The $post object is not available outside the Loop, unless you globalize it before referencing it: global $post; $variable = $post->post_title;
The $post object is not available outside the Loop, unless you globalize it before referencing it: global $post; $variable = $post->post_title;
What I ended up doing was CURLing down the external feed and then merging arrays together.
The Problem By default, in any given context, WordPress uses the main query to determine pagination. The main query object is stored in the $wp_query global, which is also used to output the main query loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); When you use a custom query, you create … Read more
If I understand well, you have a page template, and you want to use this page template as a category archive. The term to show is in a page meta field with key ‘cat_page’. If I’m right, in this page template use: the post(); // being a singular page the ‘while’ stuff is useless the_content(); … Read more
Get gallery and product gallery images full size
The Problem By default, in any given context, WordPress uses the main query to determine pagination. The main query object is stored in the $wp_query global, which is also used to output the main query loop: if ( have_posts() ) : while ( have_posts() ) : the_post(); When you use a custom query, you create … Read more
When you output your get_posts results and do this: setup_postdata($post); You overwrite the original value of $post which the_field uses to fetch the field data. It’s trying to get that field belonging to the last post in $products_mono_posts instead of the page that the field actually belongs to. After running custom queries where the value … Read more
I’m not too sure I get the question but here goes nothing: What you could do is wrap you posts loop in a PHP counter or jQuery counter to change the style of the first div at every itteration. <?php if ( have_posts() ) : ?> <?php /* Limit Number of posts returned to 4 … Read more
As usual with multiple loops, one of which is main loop, the issue is messy. What it looks like is happening: Secondary loop runs and deals with some posts. Main loop runs and deals with some posts. What is actually happening: WordPress core is loaded. Posts are queried for main loop. Template file is decided … Read more
You could make your own excerpt function: function wpse125086_custom_strip_tags_excerpt() { global $post; $p_obj = get_post($post->ID); $p_exp = $p_obj->post_excerpt; $p_exp = apply_filters(‘the_excerpt’, $p_exp); $un_p = array(“<p>”, “</p>”); $p_exp = str_replace($un_p, “”, $p_exp); echo $pcont; } But generally I’m thinking instead of transforming to get_posts() it might be better to go with WP_Query. In this case the … Read more