glinch
Forum Replies Created
-
Forum: Plugins
In reply to: [CMB2] CMB2 Attached Posts – Using field in WP_Query 'meta_query'Cheers Michael, yep I only needed this part:
'value' => strval($this_ID) ,
This works for me in my current project but would create issues if the ID value was repeated elsewhere, so not an ideal solution.
Forum: Plugins
In reply to: [CMB2] Pass $cmb->object_id to function in select optionsWhat code are you using? Will be easier to figure out where its going wrong.
If you are using the code I sent over it would suggest that there is nothing in the array you are passing to the select option.
Forum: Plugins
In reply to: [CMB2] CMB2 Attached Posts – Using field in WP_Query 'meta_query'Hi, this works but I believe it could be problematic? Or is this the correct way to do this?
array ( 'key' => '_test_cmb_attached_posts', 'value' => serialize(strval($this_ID)) , 'compare' => 'LIKE' )
Forum: Plugins
In reply to: [CMB2] Pass $cmb->object_id to function in select optionsIs this what you are after:
function contacts_get_array($cmb){ $contacts = get_post_meta( $cmb->object_id, '_dbem_user_contacts', true ); $school_contact = array(); foreach ( (array) $contacts as $key => $contact ) { //populate array with name of contact $school_contact[] = esc_html( $contact['name'] ); } return $school_contact; }
and call it
$cmb->add_field( array( 'name' => 'Test Select', 'desc' => 'Select an option', 'id' => '_wiki_test_select', 'type' => 'select', 'show_option_none' => true, 'default' => 'custom', 'options' => 'contacts_get_array', ) );
Forum: Plugins
In reply to: [CMB2] Repeating Group Field with Taxonomy SelectA better method is:
function customprefix_get_tax_array( $cmb ) { $taxonomies = array( 'custom_tax', ); $args = array( 'fields' => 'names', ); return wp_get_post_terms( $cmb->object_id, $taxonomies, $args ); }
and …
$cmb_work_group->add_group_field( $group_field_id, array( 'name' => __( 'Test Tax Select', 'cmb2' ), 'id' => 'select', 'type' => 'select', 'show_option_none' => true, 'options' => 'customprefix_get_tax_array', ) );
Forum: Plugins
In reply to: [CMB2] Pass $cmb->object_id to function in select optionsOK got it.
Call the function like so:
'options' => 'example_get_array',
And get the ID like so:
function example_get_array($cmb){ $id = $cmb->object_id; ... }
Forum: Plugins
In reply to: [CMB2] Repeating Group Field with Taxonomy SelectAfter some inspection the above doesn’t work quite as expected, get_terms returns all terms used by all posts.
Forum: Plugins
In reply to: [CMB2] Repeating Group Field with Taxonomy SelectHi
Just in case anybody requires this functionality, I have a solution that works – if there is a better method please let me know.
Essentially just involves populating a select field in a repeating group with get_terms().You will first have to select the terms for the post (and update post). Not ideal but it works. Ensures that you manually have added the taxonomy first.
function customprefix_get_tax_array( ) { $taxonomies = array( 'custom_tax', ); $args = array( 'orderby' => 'id', 'order' => 'ASC', 'fields' => 'id=>name', 'hierarchical' => false, ); return get_terms( $taxonomies, $args ); }
and call above function in the select field
$cmb_work_group->add_group_field( $group_field_id, array( 'name' => __( 'Test Tax Select', 'cmb2' ), 'desc' => __( 'field description (optional)', 'cmb2' ), 'id' => 'select', 'type' => 'select', 'show_option_none' => true, 'options' => customprefix_get_tax_array(), ) );
Forum: Plugins
In reply to: [CMB2] Repeating Group Field with Taxonomy SelectDoh!
Cheers for the heads up Michael, I completely missed that info. Thanks.
Forum: Plugins
In reply to: [Search Everything] Unnecessary script added toCheers Petra,
have added the following to my functions.php, less obtrusive way to remove it I think?
remove_action('wp_head', 'se_global_head');
Seems to work to me. Thanks for the heads up.
Noel
Hi Petra,
No problem at all. The sites in development at the moment so i couldn’t actually post you a link.
Multisite installation, WP Version is 3.9.1
As its only in development I’m not using that many plugins: Search Everything, Advanced Custom Fields and Yoast SEO.
Have disabled the search everything plugin and the error disappears, reinstall and it shows up again. Although the error shows up in the logs, the search functionality still works.
Any other info needed please get in touch.
Cheers
Noel
Forum: Plugins
In reply to: [W3 Total Cache] MFUNC still not workingI would also like to chip in that I’m also struggling to get this to work, which is quite a problem for me on a few sites. Still a great plugin I just need to get this functionality working.
Im using WP 3.5.1 and version 0.9.2.11, Using Disc:Basic & also Use late “init”.
Have tried different combinations of mfunc code, as I’m sure everybody else has, but the output still gets cached.
Forum: Plugins
In reply to: Theme My Login & square-thumbnails-for-user-photono worries, cheers for all the good work
Forum: Plugins
In reply to: Theme My Login & User PhotoThanks alot for the help, great work
Forum: Fixing WordPress
In reply to: how to restrict who can view commentsThats fantastic doodlebee, thanks alot for your help really appreciated.