How can I create a loop to build slides based on multiple categories using Coda Slider

For those who were interested in an answer to this question, I found the answer myself. <div class=”coda-slider” id=”slideshow”> <?php // array of category IDs $categories = array(1,2,3,4,5); foreach ($categories as $cat) : $post = false; $post = get_posts(‘cat=”.$cat.”&posts_per_page=1’); if($post) : $post = $post[0]; setup_postdata($post); ?> <!– rest of normal loop –> <div <?php post_class(); … Read more

Changing behavior of the loop twice in one page

Create a new WP_Query for the slider posts. <div class=”featured-rotator”> <?php $slide_query = new WP_Query( ‘category_name=featured’ ); if ( $slide_query->have_posts() ): ?><ul> <?php while ( $slide_query->have_posts() ) : $slide_query->the_post(); ?> <li class=”post”> <div class=”image”><?php the_post_thumbnail(); ?></div> <h2><a href=”https://wordpress.stackexchange.com/questions/145555/<?php esc_url( the_permalink() ); ?>” title=”Permalink to <?php the_title(); ?>” rel=”bookmark”><?php the_title(); ?></a></h2> <?php if (get_post_meta($post->ID, “Author”, true)): … Read more

Add Incrementing ID to each paragraph in the_content

If I understand your question correctly, you can try the following: add_filter( ‘the_content’, ‘incrementparagraphs’, 10, 1 ); function incrementparagraphs( $content ) { return preg_replace_callback( ‘|<p>|’, function ( $matches ) { static $i = 0; return sprintf( ‘<p data-section-id=”%d”>’, $i++ ); }, $content ); } to replace every <p> tags with <p data-section-id=”1″>, where the data-section-id … Read more

WordPress category & taxonomy loop with pagination

Don’t use ‘numberposts’=>-1 because numberposts is depracated moreover -1 shows all the post on one page. Instead use posts_per_page and set its value according to how many posts do you want. $paged= (get_query_var(‘paged’ )) ? get_query_var(‘paged’):1; global $query_string; $myquery = wp_parse_args($query_string); $myquery = array( ‘paged’ => $paged, ‘posts_per_page’=>10, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( … Read more

Apply styling only to first page sticky posts

Strange that stickies aren’t completely unset from the main loop on paged pages but only on the first page. If we look at the source, we will see that stickies are only unset from the main loop if they are on the first page. So we have two options here depending on what you exactly … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)