Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]

In your loop, you can use a variable to check, in this case $i, so the code will belong to: <?php $the_query = new WP_Query( ‘showposts=7&cat=113’ ); ?> <?php while ($the_query->have_posts()) : $the_query->the_post(); ?> <strong><a href=”https://wordpress.stackexchange.com/questions/199653/<?php the_permalink() ?>”><?php the_title(); ?></a></strong> <hr size=”1″ color=”#919191″> <?php endwhile;?> <?php $the_query = new WP_Query( ‘showposts=7&cat=113’ ); ?> <?php $i … Read more

Standard Loop – wp_query

Yes you need some arguments defined. A good place to easily get your loops defined is: https://generatewp.com/wp_query/ Here’s an example of some arguments used. // WP_Query arguments $args = array ( ‘post_type’ => array( ‘post’ ), ‘nopaging’ => true, ‘posts_per_page’ => ‘3’, ‘ignore_sticky_posts’ => true, ); // The Query $query = new WP_Query( $args ); … Read more

How to show all posts of specific custom post type with their custom fields values?

The meta information is in a different db table from my understanding. What you’ll need to do is loop through each post and grab it’s meta data using get_fields(). Below is a sample from the query to find all the fields for a particular post. $rows = $wpdb->get_results($wpdb->prepare( “SELECT option_name, option_value FROM $wpdb->options WHERE option_name … Read more

shortcode with $atts with strange results

The functions you have above don’t use the id att at all. This might be what you want, but I’m not 100% sure what you’re going for. function show_homepage_banner_function($atts) { $atts = shortcode_atts( array(‘id’ => NULL), $atts ); $content=””; global $wpdb; $upload_url=””; $upload_dir = wp_upload_dir(); $target_dir = $upload_dir[‘basedir’]; $upload_url = $upload_dir[‘baseurl’].’/banners/’; $query = “SELECT * … Read more