Forums

is_category ( when category are created dinamically but have a word in common) (2 posts)

  1. rigelito
    Member
    Posted 2 years ago #

    ok, hope that make sense,
    I have categories that are created dynamically by my users or the system, exemple are category "foto in cancun", the word cancun may change for whatever place, but the categories will always include "foto in".
    the question is how to create a specialized template for all category that have the words "fotos in" but also something else.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Saw this somewhere in the forum (I think from t31os_) that lists categories 'like'

    $categories = get_terms('category', 'name__like=foto in%');
    //$categories = get_terms('category', 'name__like=FOTO INA%');
    if ($categories) {
    	foreach($categories as $category) {
    		echo '<p><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></p> ';
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Topic