plugin content on front-page only. Nowhere else

After turning on WP_DEBUG, define(‘WP_DEBUG’, true); I was receiving the error: Conditional query tags do not work before the query is run. Before then, they always return false. After googling that error, I found a solution that works: add_action( ‘template_redirect’, ‘check_for_frontpage’ ); function check_for_frontpage() { if ( is_front_page() || is_home() ) { echo “<script>console.log( ‘Debug … Read more

AMP version of front page without plugin

is_single() will return false for Pages, so the above code as written should only work for single Posts. You’ll need to add more conditionals to your amp_page_template() function for each of the templates you want to replace with an AMP version. Depending on your settings in Settings > Reading > Front page displays, is_front_page() might … Read more

What code controls the animation for the front-page header in TwentySeventeen

Looks to be global.js, in the adjustHeaderHeight() function at lines 92 – 97 // The margin should be applied to different elements on front-page or home vs interior pages. if ( isFrontPage ) { $branding.css( ‘margin-bottom’, navigationOuterHeight ); } else { $customHeader.css( ‘margin-bottom’, navigationOuterHeight ); } It sets the margin-bottom to the equivalent of the … Read more

upload image only

I edited code if (!function_exists(‘wp_generate_attachment_metadata’)){ require_once(ABSPATH . “wp-admin” . ‘/includes/image.php’); require_once(ABSPATH . “wp-admin” . ‘/includes/file.php’); require_once(ABSPATH . “wp-admin” . ‘/includes/media.php’); } if ($_FILES) { foreach ($_FILES as $file => $array) { $mime = $_FILES[$file][‘type’]; $filesize = $_FILES[$file][‘size’]; $maxsizef = 524288; if($filesize > $maxsizef) $error_array[] = ‘error size, max file size = 500 KB’; if(($mime != … Read more

How do I activate a certain block template only when editing the front page?

Setting $post_type_object->template seems to be done on ‘init’ (or close to it) while is_front_page() is set later, so I had to use $_GET[‘post’] instead. I also changed get_post_type_object( ‘post’ ) to ‘page’. Like this: add_action( ‘init’, ‘home_block_template’ ); function home_block_template() { if ( ! is_admin() || ! isset( $_GET[‘post’] ) || get_option( ‘page_on_front’ ) !== … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)