WordPress.org

Support

Support » Plugins and Hacks » Hacks » Theme function extending

Theme function extending

  • Using the Theme ZeeDynamic. I’m trying to modify it to show frontpage blog posts from multiple categories. Direct theme support is paid, so I’m here instead!

    Settings to tell theme to use posts from specific category (settings-frontpage.php)

    ### FRONTPAGE POSTS
    		#######################################################################################
    		$themezee_settings[] = array("name" => __('Display Latest Blog Posts?', 'zeeDynamic_language'),
    						"desc" => __('Check this to show the latest blog posts in the normal blog layout on the frontpage template', 'zeeDynamic_language'),
    						"id" => "themeZee_frontpage_posts_active",
    						"std" => "false",
    						"type" => "checkbox",
    						"section" => "themeZee_frontpage_posts");
    
    		$themezee_settings[] = array("name" => __('Latest Blog Posts Category', 'zeeDynamic_language'),
    						"desc" => __("Select the category of which the latest blog posts should be displayed.", 'zeeDynamic_language'),
    						"id" => "themeZee_frontpage_posts_category",
    						"std" => "",
    						"type" => "select",
    						'choices' => $categories_slider,
    						"section" => "themeZee_frontpage_posts");
    
    		return $themezee_settings;
    	}

    Function to call that query (functions.php)

    // Retrieve Frontpage Posts Query
    function themezee_frontpage_posts_query($paged) {
    
    	// Get Query Arguments
    	$options = get_option('zeedynamic_options');
    	$frontpage_posts_category = $options['themeZee_frontpage_posts_category'];
    
    	$query_arguments = array(
    		'post_type' => 'post',
    		'post_status' => 'publish',
    		'ignore_sticky_posts' => true,
    		'posts_per_page' => 4,
    		'paged' => $paged,
    		'orderby' => 'date',
    		'order' => 'DESC',
    		'category_name' => $frontpage_posts_category
    		);
    
    	$zee_frontpage_posts_query = new WP_Query($query_arguments);
    
    	return $zee_frontpage_posts_query;

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Theme function extending’ is closed to new replies.