mikevisions
Forum Replies Created
-
Forum: Plugins
In reply to: [CMB2] Displaying term meta dataSolved it.
$mdmeta = get_term_meta( $term->term_id, 'wgmdt_term_show_free' ); echo ' <li> '.$mdmeta[0]. ' </li> ';Thanks for all your help.
Forum: Plugins
In reply to: [CMB2] Displaying term meta dataI have just done a clean wordpress install on localhost and used the default CMB2 code and get the same result with a NULL return
Forum: Plugins
In reply to: [CMB2] Displaying term meta dataSadly that still does not work.
Using var dump returns NULL
I have tried this with the default CMB2 code for a text field and that does not display either.Forum: Plugins
In reply to: [CMB2] Displaying term meta dataThis is the cmb2 code for generating the custom field
add_action( 'cmb2_admin_init', 'yourprefix_register_taxonomy_metabox' ); /** * Hook in and add a metabox to add fields to taxonomy terms */ function yourprefix_register_taxonomy_metabox() { $prefix = 'wgmdt_term_'; /** * Metabox to add fields to categories and tags */ $cmb_term = new_cmb2_box( array( 'id' => $prefix . 'edit', 'title' => __( 'Category Metabox', 'cmb2' ), // Doesn't output for term boxes 'object_types' => array( 'term' ), // Tells CMB2 to use term_meta vs post_meta 'taxonomies' => array( 'supplier_categories' ), // Tells CMB2 which taxonomies should have these fields // 'new_term_section' => true, // Will display in the "Add New Category" section ) ); $cmb_term->add_field( array( 'name' => __( 'Show free entries', 'cmb2' ), 'desc' => __( 'field description (optional)', 'cmb2' ), 'id' => $prefix . 'show_free', 'type' => 'select', 'show_option_none' => false, 'options' => array( 'yes' => __( 'Yes', 'cmb2' ), 'no' => __( 'No', 'cmb2' ), ), ) ); }Forum: Plugins
In reply to: [CMB2] Displaying term meta dataHi Michael,
Thanks for your offer of help.
I am using the get term meta from the codex. It is also the same format that I have working for custom post meta. I am using it in a custom taxonomy but have tried it in a standard category and got the same result so I don’t think it is anything to do with custom taxonomy or custom post type.
‘wgmdt_term_ is the prefix and show_free is the key for the custom field. I have confirmed that this is being saved in the termmeta table.$mdmeta = get_term_meta( term_id, 'wgmdt_term_show_free' ); echo ' <li> '.$mdmeta. ' </li> ';Forum: Plugins
In reply to: [CMB2] Displaying term meta dataHi Michael,
var_dump gives me bool(false)
If I echo the term id it prints out correctly.
Removing the custom field key so that all meta data prints out also gives me bool(false)
I am at a loss to understand what is going on.Forum: Hacks
In reply to: echo some text only if a custom taxonomy has postsThanks for that. I was looking at Taxonomy rather than term.
This is the code I came up with;<?php $term = get_term_by(‘slug’, ‘gifts’, ‘business_category’); $name = $term->name;
if($name) {
echo ‘ print something ‘;
} ?>Forum: Networking WordPress
In reply to: Advice on best way of setting up a network of sitesI was thinking a redirect via ht access?
Forum: Networking WordPress
In reply to: Advice on best way of setting up a network of sitesHi Bet,
Thanks for the response.I understand what you are saying and that I am perhaps trying to do something that multisite is not designed to do. In your opion do you think it would be a more realistic idea to use a standard install with custon landing pages for each area site?