New answers tagged

0

the_content will return the whole content of the post and not particular part. If you want to access your particular part, then you can go for shortcode. For eg, if you have content like this in your post Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's [mycustomtextpart] standard dummy ...


0

If you want to apply the add_action and do_action in combination with class object, you have to use a static function to access your class. Try this code with your own wording/variables: class My_Plugin { protected static $_instance = null; // Static function used to access this class public static function get_instance() { if ( ...


0

Those actions always get called by the Genesis framework. I mean these are hook positions and they are always fired by genesis so that any functions tagged/hooked to those hooks will be called at those locations.. so it will always be 1 i.e. yes action hook was executed. As discovered rightly by OP, using has_action instead of did_action did the job.


0

Sorry to post this as an answer when it should be a comment. After struggling for a while with calling a sidebar in a hook problem, I'd like to mention that sidebar ID should be all lower case. I you use a capital letter in sidebar ID (ex: 'Secondary'), the registered sidebar will appear in wp-admin, you may add widgets to it, but if you don't register the ...


1

I suggest post status transitions that runs only when your set conditions are met. Example: add_action( 'transition_post_status', 'add_awesome_terms', 10, 3 ); function add_awesome_terms( $new_status, $old_status, $post ) { // only run when it's a page, new status is publish and old status isn't publish if ( $post->post_type == 'page' ...


1

A var_dump() in save_post action doesn't display any information on the screen. Well, it does only when you are on "Add new" screen. This is due the different sequence of actions that follow when creating a new post or when editing it. When you click on "publish" or "update" button, there is a request, the post is saved, save_post action is triggered and ...


0

Found the answer here: http://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme--cms-22623 <?php function child_remove_parent_function() { remove_action( 'woocommerce_before_main_content', 'mod_output_content_wrapper', 10 ); } add_action( 'wp_loaded', 'child_remove_parent_function' ); ?> Explanation is ...


2

Since plugins hook directly into wp_head nothing will happen if it's not there unless you change the plugin code. So, you'd have to create your own hook in the theme, then scan the Yoast files for any calls to wp_head and change them. Not recommended, though. A better course of action would be to generate these metatags yourself. They're pretty ...


3

wp_head is an essential part of the theme, and there is too many things that might fall apart if it is not there. Hunting and fixing them one by one might be time consuming and the worthiness of the all operation questionable. In you snippet for example you want to remove things that make no sense to remove specifically only for one CPT, and if you have ...


0

I found this answer partly the question, // check for the existence of "some_hook_filter" filter if( array_key_exists( 'some_hook_filter' , $GLOBALS['wp_filter']) ) { //do your code here } However, as noted by the original contributor, this will not turn up all possible filters depending on when the code executes. Theme contributed filters will not show ...



Top 50 recent answers are included