Want to images load first then title in WordPress loop

Try it <div class=”main-interior portfolio” id=”portfolio-big-pics” style=”display: block;”> <?php $args = array( ‘post_type’ => ‘portfolio’, ‘order’ => ‘ASC’); $loop = new WP_Query( $args ); $img_titles=””; while ( $loop->have_posts() ) : $loop->the_post(); $extraLastClass = $loop->current_post + 1 === $loop->post_count ? ‘ main-image-porfolio-main’ : ”; the_post_thumbnail( “thumbnail”, array( “class” => “main-image portfolio $extraLastClass” ) ); $img_titles .= … Read more

Custom post order returning posts from other categories

In WP_Query(), there is no category reference passed so this is the point which returns all category post. Please try with passing category ID here: $the_query = new WP_Query(array( ‘cat’=4, //Your category ID ‘posts_per_page’ => -1, ‘meta_key’ => ‘adult_price’, ‘orderby’=> ‘meta_value_num’, ‘order’ => ‘ASC’ )); OR $the_query = new WP_Query(array( ‘category_name’=staff, //Your category name… ‘posts_per_page’ … Read more

How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes

Probably you need to create a shortcode with parameters. You should have different parameters for font size, color, bold, underline or anything else. The user should insert a value for each of these parameters in the shortcode. You can find what you need here https://developer.wordpress.org/plugins/shortcodes/shortcodes-with-parameters/ It is a little tricky though because you must check … Read more

Error in Wordprewss loop for page template [closed]

I wasn’t able to recreate the error. Maybe it’s coming from <?php get_sidebars(‘right’); ?> I did change your code a little, but it didn’t give the “unexpected endwhile” error you spoke of. If it’s coming from line 1 I’d guess it’s the header.php file? Here is the adjusted code if you want to try it: … Read more

Fix html inside a for loop [closed]

First of all you have the PHP syntax all messed up. Second, you misused some WordPress template tags – you already echo the entire link like so you need to return post permalink and title, but right now the_permalink and the_title_attribute functions echo the code. Here’s your code fixed: foreach( $terms as $term ) : … Read more