title not being printed within html tag [closed]
found the problem, the tags need to be inside the () like the_title(‘<span>’,'</span>’)
found the problem, the tags need to be inside the () like the_title(‘<span>’,'</span>’)
Yes you can do that using $wp_query->current_post inside the loop. It returns the current posts index number inside the loop (starting form 0). Have a look at the following code block <?php global $wp_query; while(have_posts()){ the_post(); the_title(); //do your other stuff if($wp_query->current_post==1){ //do what you want to do after 2nd post }else if($wp_query->current_post==5){ //do what … Read more
You’re example is totally unclear. What is ngegrab, what is $unity, $yesPage and what do you mean with “WordPress title”? Short: what are you trying to do exactly? To get the title of a post, use get_the_title() as mentioned in the other answer. To get the document title (<title></title>), use wp_get_document_title().
Please read the documentation. ‘rating’ is not a valid value for orderby. To sort by a custom field you need to use ‘orderby’ => ‘meta_value’ or ‘meta_value_num’. Note that a ‘meta_key=keyname‘ must also be present in the query. Note also that the sorting will be alphabetical which is fine for strings (i.e. words), but can … Read more
$posts = get_posts( array( ‘post_author’ => get_current_user_id(), ‘post_status’ => ‘any’, ‘post_type’ => ‘any’, ) ); foreach ( $posts as $post ) printf( ‘<a href=”https://wordpress.stackexchange.com/questions/103977/%s”>%s</a><br />’, esc_attr( add_query_arg( ‘_ninja_forms_action’, ‘edit’, get_permalink( $post ) ) ), get_the_title( $post ) );
As you have updated WooCommerce to latest version, templates you have in your theme must have gone outdated. (Not sure which previous version you had on your website before updating it to latest version). Please check WP Admin -> WooCommerce -> System Status -> at bottom there will be section named “Templates” there you can … Read more
You could make use of the WP_Query property $current_post $current_post (available during The Loop) index of the post currently being displayed. It can be used for your purpose.
That’s because the code you listed only includes a reference for the title and the link. Here’s your original code, annotated … Original <?php $debut = 0; //The first article to be displayed ?> <?php while(have_posts()) : the_post(); ?> <!– Display the title of the current page that’s listing your posts –> <h2><?php the_title(); ?></h2> … Read more
Use: get_the_tags(); With the Post $idparameter so it works outside the loop Source: get_the_tags
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