Nested loop called with shortcode duplicating the content above the main loop

You have few errors in your code. Below you can see how it should look like: function cd_random_testimonial($atts) { // EXAMPLE USAGE: // [loop the_query=”showposts=1&post_type=testimonials&orderby=rand”] // Defaults extract(shortcode_atts(array( ‘the_query’ => ” ), $atts)); // de-funkify query $the_query = preg_replace(‘~&#x0*([0-9a-f]+);~ei’, ‘chr(hexdec(“\\1”))’, $the_query); $the_query = preg_replace(‘~&#0*([0-9]+);~e’, ‘chr(\\1)’, $the_query); // query is made $my_query = new WP_Query( $the_query … Read more

Category callback box problem

Yes there is such possibility. Just change your code to this: $main_category_name = YOUR MAIN CATEGORY NAME; // get the main category of this section (i.e nadchodzące) foreach( ( get_the_category() ) as $category ) { if ( $category->cat_name != $main_category_name ) { $category_name = $category->cat_name; $category_url = get_category_link($category); $cat_com_url = get_comments_link(); } <span class=”cb-category”><a href=”https://wordpress.stackexchange.com/questions/106337/<?php … Read more

gallery – size is thumbnail by default change it to medium [duplicate]

Add below in you functions.php file, add_filter(‘post_gallery’,’wpse56909_post_gallery’,10,2); function wpse56909_post_gallery($output, $attr) { // We’re trusting author input, so let’s at least make sure it looks like a valid orderby statement if ( isset( $attr[‘orderby’] ) ) { $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] ); if ( !$attr[‘orderby’] ) unset( $attr[‘orderby’] ); } extract(shortcode_atts(array( ‘order’ => ‘ASC’, ‘orderby’ => … Read more

Set static page as default front page on newly created sites in multisite

Try the following code. Based on these two Q&A’s (not tested): How to add Custom Blog Options to new blog setup form? Programmatically set page_on_front add_action( ‘wpmu_new_blog’, ‘process_extra_field_on_blog_signup’, 10, 6 ); function process_extra_field_on_blog_signup( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { switch_to_blog($blog_id); $homepage = get_page_by_title( ‘Sample Page’ ); if ( $homepage ) { update_blog_option( $blog_id, … Read more

How to display posts on template

$args = array( ‘posts_per_page’=>-1, ‘number_posts’=>-1, ‘category’=>9, ‘orderby’=>’post_date’, ‘order’ => ‘DESC’, ‘post_type’=>’post’, ‘post_status’=>’publish’ ); $posts = get_posts($args); foreach($posts as $post): $id= $post->ID; $permalink = get_permalink( $id ); $title = $post->post_title; $content = $post->post_content; $image = wp_get_attachment_url(get_post_thumbnail_id($id)); endforeach;

Can’t edit thumbnails

This bug was caused by empty lines between php tags… <?php function(){ … } ?> <?php function(){ … } ?> needs to be: <?php function(){ … } ?> <?php function(){ … } ?> wordpress.org Credit: wordpress.org