Tag Info

New answers tagged

0

I'd recommend using the template_include filter as opposed to template_redirect, as using this hook means that you don't redirect the user but rather just present them with the template that is requierd. add_filter('template_include', 'my_custom_template_redirect', 99); function my_custom_template_redirect($template){ global $post; if(is_single() ...


0

After reading a bunch of tips for running a WP_Query filtering by serialized arrays, here's how I finally did it: by creating an array of comma separated values using implode in conjunction with a $wpdb custom SQL query utilizing FIND_IN_SET to search the comma separated list for the requested value. (this is similar to Tomas's answer, but its a bit less ...


0

The easiest solution is to use jQuery. Add the below code to any JS file that you include in the admin area. As you haven't given very much information above I don't know a couple of things, so you'll need to amend this example slightly - Change your-post-type to the slug of the post type for which this metabox exists. If it's the default Post then it'll ...


1

Maybe they are just disabled? I've already seen a lot of people tripping over this one: On the top right of the edit screen you can see "Screen Options". If you open this section you can enable and disable meta boxes. Maybe yours is deactivated? Source: Screen Options


0

So awkwardly realised I'd been going about this whole thing in a stupid roundabout way and in fact Milo above in the comments is completely right, and proves that the codex still has secrets for everyone, or maybe just me. The eureka (or durr-eka) moment came after reading this post here about setting up and editing the content of the metaboxes. Instead of ...


0

Firstly, remember that because you are basing this on category IDs, you will need to save the post under category '5' before the box will appear. When I tested your code the meta box did appear after I saved the post, but you had an error. add_meta_box('team_meta', 'My Custom Meta Box 1', 'team_meta', 'post', 'normal', 'high'); This line should actually ...


0

This could be easily accomplished using the plugin Advanced Custom Fields which allows you to easily create relationships between custom post types. However if you don't want to use the plugin, you can also create the metaboxes yourself. Create a custom post type for Productions Create any necessary custom fields for Productions Create a custom pos type ...


0

First thoughts - a custom tax for actors might work. The Taxonomy Images plugin will make adding the headshot easy. I'd maybe make the production a post - or an instance of a CPT - I wouldn't mess around with CSVs at all. You'd build the table in the post. I would perhaps create a shortcode that you could add into this table, which would generate a link ...


1

Try adding this in your functions.php file: // Let's stop WordPress re-ordering my categories/taxonomies when I select them function stop_reordering_my_categories($args) { $args['checked_ontop'] = false; return $args; } // Let's initiate it by hooking into the Terms Checklist arguments with our function above ...


1

The reason why your code doesn't work is most likely that you've ordered your metaboxes before, and the that order has been saved into the meta-box-order_page meta value. This overrides the default setup. Here's an example of the meta-box-order_post meta value: a:3:{ s:4:"side"; ...


0

Yes it is possible but not exactly trivial or well documented. The easiest option is to have different comment types (ie, have new ones in addition to the traditional comment, pingback and tracback). The biggest problem with this approach is that most of wordpress API and admin is not built to be flexible enough to sopprt different comments types, for ...


0

By default WordPress doesn't load admin classes/function definitions in the front end of the site. You need to explicitly require the files. As far as I remember requiring wp-admin/includes/admin.php would get you most of typical stuff.


1

Register a menu is really register a menu location, but I think you don't need to register locations so you can avoid the register step. I think what you need is wp_nav_menu( ) function. For example, in the page template: //Get the menu slug stored in page custom meta field //Replace menu_meta_field_name with the correct name of the meta field $menu_slug = ...


1

I think that the most important question here is, Does this functionality add functionality to my theme or to my site? Page templates in general are theme territory and in my opinion should stay in a theme. This does not mean any functionality on which a template depend should be in the theme as well. These meta boxes that you are talking about can either ...


0

Embedded two galleries in the order according to my need. Then used the get_post_galleries to get the galleries in an array.


0

Yes as per @Nibbr Web Development, TinyMCE editor IDs cannot have brackets. Which is the html field ID, so what we will do is create a different but similiar name for the ID attribute and still use our desired name in for the text area field name, like so. $content = $options['textareafield']; // editor_id cannot have brackets and must be lowercase ...


0

disabled fields can't be submited, that is as is. Change disabled to readonly and it will submit.


0

The problem was with this line: if(!$related_resources OR $related_resources == '') return; I changed it to: if($related_resources == '') return; And it started working properly. I hope others can make use of the code too. Thanks!


0

The below code solves this problem: metabox.js code: jQuery(function($) { function my_check_categories() { $('#my-meta-box').hide(); // intially hides the metabox /* script to show metabox on category ids 2,3 and 4 (write the category ids in the if condition below on line 14)*/ $('#event-categorieschecklist ...



Top 50 recent answers are included