Database sync between local and production

If you have databases reachable from the outside ie: mysql1.example.com you can work on a local development environment connected to that the whole time. I just found a nice thing to put in wp-config.php to be able to change the host depending on your environment $host = $_SERVER[‘HTTP_HOST’]; define( ‘WP_HOME’, ‘http://’ . $host ); define( … Read more

Which template holds what to display when search returns nothing

get_template_part( ‘content’, ‘none’ ); will look for: content-none.php content.php Twenty Thirteen does have content-none.php. In general this is organized in such way to support dynamic lookups where first two-part template might or might not exist and fallback to more generic template, if necessary.

Change Content for Specific Page

Your function is signup but you’re hooking check_for_signup. You’re also trying to apply the_content filters from within a function that’s hooked to the_content: function wpse_225562_replace_for_signup( $content ) { if ( strcmp( ‘signup_slug’, get_post_field( ‘post_name’ ) ) === 0 ) { $content=”Sign up, bitch.”; } return $content; } add_filter( ‘the_content’, ‘wpse_225562_replace_for_signup’ ); Here we are simply … Read more

Gutenberg First Block on Page Conditional?

Here’s a solution I’ve come up with, that works with WordPress 5.4 and ACF Pro 5.8.9. First you need this function somewhere in functions.php: /** * Get ID of the first ACF block on the page */ function sg_get_first_block_id() { $post = get_post(); if(has_blocks($post->post_content)) { $blocks = parse_blocks($post->post_content); $first_block_attrs = $blocks[0][‘attrs’]; if(array_key_exists(‘id’, $first_block_attrs)) { return … Read more

Adding content to sidebars

Add a meta box to the post editor, similar to the excerpt meta box, and get the content of the meta box in your sidebar. If you want to reuse the same text on different pages create a custom post type sidenotes and add a meta box with a select field to let the author … Read more

Customize in category page

Review the template hierarchy from the Codex to gain a better understanding of what files are read when. This will help you to understand what’s called in what situation (tag/category/front-page/etc). Content.php is never mentioned in the documentation as its not a part of the template hierarchy. Theme developers will use different file names and will … Read more