"How to" - pimp BLOG-SHORTCODE

resolved (3 posts) (2 voices)

  1. HeliR
    Member

    Goal: enhance the blog shortcode to SORT and to select other ORDERBY criteria

    use the modified shortcode then like

    orginal shortcode: [ blog_list thumb="small" ]
    MODIFIED order DESC: [ blog_list thumb="small" orderby="modified" order="DESC"]
    MODIFIED ASC [ blog_list thumb="small" orderby="modified" order="ASC"]
    TITEL order ASC [ blog_list thumb="small" orderby="title" order="ASC"]
    Titel order DESC [ blog_list thumb="small" orderby="title" order="DESC"]

    .... and so on, see CODEX - WP_QUERY

    file: ..... wp-conten/themes/xxx/lib/shortcodes/14-blog.php

    add in about Line 195 the parsing of the arguments --> the lines marked with //heli

     		$defaults = array(
    			'thumb' 		=> '',
    			'showposts'		=> '',
    			'offset' 		=> '',
    			'post_content'	=> '',
    			'categories' 	=> '',
    			'pagination' 	=> '',
    			'disable' 		=> '',
    			'post_in'		=> '',
    			'category_in'	=> '',
    			'tag_in'		=> '',
    			'orderby'		=> 'date',    //heli
    			'order'	    	=> 'DESC'	  //heli
    		);
    

    same for the line 264 (former 262)

    		$blog_query->query(array(
    				'post__in' => $post_in,
    				'category__in' => $category_in,
    				'tag__in' => $tag_in,
    				'post_type' => 'post',
    				'showposts' => $showposts,
    				'nopaging' => 0,
    				'offset' => $offset,
    				'ignore_sticky_posts' => 1,
    				'orderby' => $orderby,   //heli
    	            'order'  => $order		 //heli
    			));
    		}
    

    if you want to load the image-thumbs in a fly without spinning wheel then replace about line 360 "filter_args" at by following line:

         $filter_args = array( 'width' => $width, 'height' => $height, 'img_class' => $img_class, 'link_class' => '_blog_sc_image_load_', 'preload' => false, 'post_content' => $post_content, 'disable' => $disable, 'column' => $column, 'thumb' => $thumb, 'type' => $args['type'], 'shortcode' => true, 'echo' => false ); 

    I hope these modifications are transferred in the original framework

    Posted 4 months ago #
  2. smudgedesign
    Member

    good work. any idea on how to modify this further to allow for custom post types and custom taxonomies to be used instead of the 'post_type' => 'post' and 'category__in' => $category_in,
    that would be really handy!

    Posted 4 months ago #
  3. smudgedesign
    Member

    if anyone else is looking for this elliott fixed it for a custom post type: see here:

    http://mysitemyway.com/support/topic/blog-shortcode-to-query-custom-post-type-taxonomy

    Posted 4 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme