Remove Page Title from Static Frontpage
wrap your add_filter function call around a conditional tag and use the builtin return false function: if ( is_page(‘138’) ) { add_filter( ‘the_title’, ‘__return_false’ ); }
wrap your add_filter function call around a conditional tag and use the builtin return false function: if ( is_page(‘138’) ) { add_filter( ‘the_title’, ‘__return_false’ ); }
Hooks is the collective name for filters and actions. Both are meant to change the normal behaviour of functions. Programmatically speaking there is no big difference, as you can see from the fact that in the WP source code adding an action is the same as adding a filter. The difference is in the usage. … Read more
When using the block.getSaveElement hook can you output different markup based on whether or not you are in the edit view or the live page view?
Initially. It should be said that WooCommerce is considered a plugin and therefore your question could probably be flagged as ‘Off-topic’. This (however) is such a bullshit and self-deprecating for this StackExchange, so I’ll answer it anyway. 🙂 But next time you have a WooCommerce-question, you should ask it on StackOverflow (apparantly). My first thought … Read more
Every time a post changes status, wp_transition_post_status function will be called. This triggers the actions ${old_status}_to_${new_status} and ${new_status}_${post->post_type}, so for example publish_post will be triggered here. A post with a date in the future will have the status future until it is actually published, so this should work for you.
If I understood you right… [A] Multi-Tax queries have the problem that they’re doing a JOIN of the meta table for every term. So imho it’s not the best idea to use the built in way. [B.1.a] I’d simply do a normal query with a one (main-)tax arg and then do the sorting depending on … Read more
Use the action ‘login_init’ to catch all calls to wp-login.php. Sample code: add_action( ‘login_init’, ‘wpse_51227_validate_custom_field’ ); function wpse_51227_validate_custom_field() { if ( ! isset ( $_POST[‘special_custom’] ) return; if ( ! is_numeric( $_POST[‘special_custom’] ) // handle the error } There are two important global variables available: $errors is an instance of WP_Error. Maybe you want to … Read more
Maybe the problem happens because you don’t check if your hook is already scheduled. if ( !wp_next_scheduled( ‘first_hook’ ) ) { wp_schedule_event(time()+60, ‘daily’, ‘first_hook’); }
This question has been answered on Stack Overflow before: https://stackoverflow.com/a/14626254/844732 add_action( ‘admin_head’, ‘check_page_template’ ); function check_page_template() { global $post; if ( ‘page-homepage.php’ == get_post_meta( $post->ID, ‘_wp_page_template’, true ) ) { // The current page has the foobar template assigned // do something } }
Actually, it turned out quite easy, as the post can be retrieved from the slug: // get the url of the reffering post $ping_slug = $comment->comment_author_url; // keep just the slug $ping_slug = trim(parse_url($ping_slug, PHP_URL_PATH), “https://wordpress.stackexchange.com/”); // get the post from the slug $ping_post = get_page_by_path($ping_slug, OBJECT, ‘post’); // find the post author data $ping_author … Read more