Need small coding with Custom Fields Search
Instead of $formAction = get_option(‘home’); use $formAction = get_template_part( ‘search’ );
Instead of $formAction = get_option(‘home’); use $formAction = get_template_part( ‘search’ );
Internally post meta are handled via object cache that is hardly filterable. The only chance to filter post metadata is to use the ‘get_post_metadata’, but that filter is triggered when meta data are not available, so there is nothing to filter, it was intended to short-circuit the result more than to filter them. So the … Read more
If you are working with serialized data as your meta_value, that sucks, as Pieter suggested, it’s best not to. However if there is no way around the serialization problem then I wonder if a meta_query using a compare value of LIKE might help… Example: //psuedo serialized data… (e.g. value of meta_key = fruits_user_like) //a:4:{i:0;s:5:”apple”;i:1;s:6:”orange”;i:2;s:6:”banana”;i:3;s:31:”serialized_data_sucks_sometimes”;} $users … Read more
Kind of confusing question, but I think you want: [mp3-jplayer tracks=”‘.implode(‘, ‘, get_post_meta($post->ID, ‘mp3’, false)).'”] Assuming you get a array of meta key values this will join the into a comma-separated string
I think what you want is to create what WorpPress calls “Custom Post Types”. Please have a look at the Post Type page in the Codex that explains what Post Types are and how to create custom ones. Basically, here is the code to create the Object custom post type : add_action( ‘init’, ‘create_post_type’ ); … Read more
Lets try the following: By default, all posts are returned regardless of comment_status, so lets run the main query as normal, that is, query all posts regardless of comment_status. We will also run a small, but very lean secondary query where we will get all posts which have a comment_status of closed which have a … Read more
See my comment on your question above. I just realized that if you’re ending up with those special characters in the database, most likely you’re not sanitizing the data before saving it into the database. Try running htmlentities() over all the values that you’re saving into that serialized array, and see if you end up … Read more
There is at least 2 ways to get custom order item meta data from a defined meta key: 1) Since WooCommerce 3 – Using WC_Data method get_meta() 2) The older way – Using wc_get_order_item_meta() WooCommerce function So your hooked function bs_order_lead_time_data() code will be: add_action( ‘woocommerce_my_account_my_orders_column_order-lead-time’, ‘bs_order_lead_time_data’ ); function bs_order_lead_time_data( $order ) { foreach ( … Read more
The built-in WP search looks only a Posts’/Pages’ Title and Content, not thru other elements like Custom Fields and the content of Shortcodes. There’s a number of plugs that will search Custom Fields: http://wordpress.org/extend/plugins/wp-custom-fields-search/ http://wordpress.org/extend/plugins/search-everything/ http://wordpress.org/extend/plugins/relevanssi/ There also a filter apply_filters_ref_array() that “allows plugins to contextually add/remove/modify the search section of the database query.” FYI, … Read more
If you don’t feel any performance degradation then there is no problem. If it took you two years to get to this state then you probably safe for another two years, which is almost forever in the time scale of the internet (unless you are CNN or similar). This doesn’t mean that you should not … Read more