Skip to main content
added 83 characters in body
Source Link

get_terms that have custom sticky field = truechecked

I was able to add a extra custom field, named sticky, to a custom taxonomy, using the wp taxonomy meta plugin, like this:

function YOUR_PREFIX_register_taxonomy_meta_boxes()
{
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if ( !class_exists( 'RW_Taxonomy_Meta' ) )
        return;

    $meta_sections = array();

    // First meta section
    $meta_sections[] = array(
        'title'      => 'Sticky',             // section title
        'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional
        'id'         => 'sticky',                 // ID of each section, will be the option name

        'fields' => array(                             // List of meta fields
            array(
                'name' => 'Show in home filters',
                'id'   => 'sticky',
                'type' => 'checkbox',
            ),
        ),
    );
    foreach ( $meta_sections as $meta_section )
    {
        new RW_Taxonomy_Meta( $meta_section );
    }
}

enter image description here

Now I'm trying to get all the taxonomies that has this value checked, like this:

$types = $types = get_terms( 'tvr_amenity', array(
    'parent'    => '0',
    'hide_empty' => 1,
    'sticky' => 1
 ) );

But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:

$types = $types = get_terms( 'tvr_amenity', array(
        'parent'    => '0',
        'hide_empty' => 1
     ) );

Any idea what I'm missing, here?

get_terms that have sticky field = true

I was able to add a extra custom field, named sticky, to a custom taxonomy, using the wp taxonomy meta plugin, like this:

function YOUR_PREFIX_register_taxonomy_meta_boxes()
{
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if ( !class_exists( 'RW_Taxonomy_Meta' ) )
        return;

    $meta_sections = array();

    // First meta section
    $meta_sections[] = array(
        'title'      => 'Sticky',             // section title
        'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional
        'id'         => 'sticky',                 // ID of each section, will be the option name

        'fields' => array(                             // List of meta fields
            array(
                'name' => 'Show in home filters',
                'id'   => 'sticky',
                'type' => 'checkbox',
            ),
        ),
    );
    foreach ( $meta_sections as $meta_section )
    {
        new RW_Taxonomy_Meta( $meta_section );
    }
}

Now I'm trying to get all the taxonomies that has this value checked, like this:

$types = $types = get_terms( 'tvr_amenity', array(
    'parent'    => '0',
    'hide_empty' => 1,
    'sticky' => 1
 ) );

But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:

$types = $types = get_terms( 'tvr_amenity', array(
        'parent'    => '0',
        'hide_empty' => 1
     ) );

Any idea what I'm missing, here?

get_terms that have custom sticky field checked

I was able to add a extra custom field, named sticky, to a custom taxonomy, using the wp taxonomy meta plugin, like this:

function YOUR_PREFIX_register_taxonomy_meta_boxes()
{
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if ( !class_exists( 'RW_Taxonomy_Meta' ) )
        return;

    $meta_sections = array();

    // First meta section
    $meta_sections[] = array(
        'title'      => 'Sticky',             // section title
        'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional
        'id'         => 'sticky',                 // ID of each section, will be the option name

        'fields' => array(                             // List of meta fields
            array(
                'name' => 'Show in home filters',
                'id'   => 'sticky',
                'type' => 'checkbox',
            ),
        ),
    );
    foreach ( $meta_sections as $meta_section )
    {
        new RW_Taxonomy_Meta( $meta_section );
    }
}

enter image description here

Now I'm trying to get all the taxonomies that has this value checked, like this:

$types = $types = get_terms( 'tvr_amenity', array(
    'parent'    => '0',
    'hide_empty' => 1,
    'sticky' => 1
 ) );

But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:

$types = $types = get_terms( 'tvr_amenity', array(
        'parent'    => '0',
        'hide_empty' => 1
     ) );

Any idea what I'm missing, here?

edited title
Link

get_terms that match a custom meta valuehave sticky field = true

Tweeted twitter.com/#!/StackWordPress/status/396438744401977344
Source Link

get_terms that match a custom meta value

I was able to add a extra custom field, named sticky, to a custom taxonomy, using the wp taxonomy meta plugin, like this:

function YOUR_PREFIX_register_taxonomy_meta_boxes()
{
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if ( !class_exists( 'RW_Taxonomy_Meta' ) )
        return;

    $meta_sections = array();

    // First meta section
    $meta_sections[] = array(
        'title'      => 'Sticky',             // section title
        'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional
        'id'         => 'sticky',                 // ID of each section, will be the option name

        'fields' => array(                             // List of meta fields
            array(
                'name' => 'Show in home filters',
                'id'   => 'sticky',
                'type' => 'checkbox',
            ),
        ),
    );
    foreach ( $meta_sections as $meta_section )
    {
        new RW_Taxonomy_Meta( $meta_section );
    }
}

Now I'm trying to get all the taxonomies that has this value checked, like this:

$types = $types = get_terms( 'tvr_amenity', array(
    'parent'    => '0',
    'hide_empty' => 1,
    'sticky' => 1
 ) );

But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:

$types = $types = get_terms( 'tvr_amenity', array(
        'parent'    => '0',
        'hide_empty' => 1
     ) );

Any idea what I'm missing, here?