• Want to display posts with particular taxonomy such as a custom taxonomy subgroup?

    Well in current Site Creator Ultimate this is about the only thing you can’t do.

    But with a little code modification you can hijack the cat1 shortcode option to display any taxonomy term id. This of course includes categories, link categories, post formats, post tags , nav menu, and custom taxonomies.

    The only hard part once you have done the code modification below is that you will have to get the term id to use.

    For categories, link categories, tags, and custom taxonomies, just go to the relevant item in the WordPress dashboard and grab the tag_ID from the item’s link.

    For these and others you can peruse the wp_terms table in the database and grab the term_id for the matching item.

    To use change the following lines in the Site Creator Ultimate file lib.php for the function scu_query().

    //category
    
            $c1 = scu_val('cat1', $scu_layout);

    to

    //category
    
            $c1 = scu_val('cat1', $scu_layout);
    
    		global $wpdb;
    
    		if ( $c1 ) {
    			$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id=$c1") );
    
    			if ( $taxonomy && $taxonomy != 'category' ) {
    				//Taxonomy is either 'link_category, post_format, post_tag, nav_menu, or custom taxonomy
    				$q['tax_query'] = array(
    					array(
    						'taxonomy' => $taxonomy,
    						'field' => 'id',
    						'terms' => $c1
    					)
    				);
    
    				$c1 = 0;
    			}
    		}

    Cheers
    TheProfessor

    https://www.ads-software.com/extend/plugins/site-creator-ultimate/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi professor,

    do you know how to get only posts with special custom fields values of a category?

    Whtat I want to do is to show only posts of a specific town belonging to the category xyz. The town is stored in a custom field.

    Further I want to use a $_POST or $_GET command to send the special town. Any ideas?

    This is my page:

    Thread Starter professor99

    (@professor99)

    Not sure what you are really wanting here as your terminology is confusing. Also I’m not really much of an expert with site creator ultimate but I did modify it as above.

    The category is stored in the $c1 variable so that’s easy.

    Don’t know anything about custom fields with site creator ultimate so cant help there.

    $_POST or $_GET are just two PHP variables that contain variables sent with the original HTML page request. Hence don’t know what you mean by “send the special town”.

    Cheers
    The Professor

    Hey Professor, Do you do any consulting work?

    And or Development?

    @tsinclair1982 – these forums aren’t for hiring people or soliciting work – sorry, it just attracts too much spam. If you are looking to hire someone, you can post a job listing here:

    https://jobs.wordpress.net/

    As per the forum rules, this thread is now closed –

    https://codex.www.ads-software.com/Forum_Welcome#Offering_to_Pay

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display posts with a particular taxonomy’ is closed to new replies.