Show TwentyEleven header image only on home page

To remove the header image of the Twenty Eleven theme on other pages then your homepage, change the following code in header.php (in wp-content/themes/twentyeleven) Before: <?php // Check to see if the header image has been removed $header_image = get_header_image(); if ( ! empty( $header_image ) ) : ?> After: <?php // Check to see … Read more

Where does the 404 redirection happen?

Based on your comments, I think I get what you’re saying. However, you don’t want to redirect on a 404, since it defeats the object of the ‘Not Found’ header. However, you can filter the 404 template path and pass back your own; function __custom_404( $standard_404 ) { if ( something_is_true() ) return ‘/absolute/path/to/custom.php’; return … Read more

get_page_by_title not working when used with a variable

Man this was an annoying problem for me as well because I a function passing the variable and when tested it showed a value (with special characters, like “&”. If I reset the value statically it worked but otherwise same issue. I ran html_entity_decode() on the variable and it now works perfectly so thought I … Read more

Add custom admin menu item for pages using a certain template

If this is what you want: … you can do it like so: Step #1: Add the custom menu item (Retailer Sendout). function add_retailer_sendout_admin_menu() { $slug = ‘edit.php?post_type=page&template=page-retailer-sendout.php’; add_menu_page( ‘Retailer Sendout’, ‘Retailer Sendout’, ‘edit_pages’, $slug, ”, ‘dashicons-admin-page’, 19 ); } add_action( ‘admin_menu’, ‘add_retailer_sendout_admin_menu’ ); Notes: I’m using add_menu_page() to add the menu (which is a … Read more

Multiple pages on a single page

Take a look at WordPress Page Templates; You can create a file with structure to match your current theme and place your code in the content area ( or place an action hook for your special content ). Example for Twenty Twelve: /* Template Name: My Custom Page */ get_header(); ?> <div id=”primary” class=”site-content”> <div … Read more

What are the options for running custom css and javascript files on a page?

You can use WordPress built in functionality Function Reference/is page and attach a if statement in your script_enqueue() function in your functions.php file. Read more in the Codex: https://codex.wordpress.org/Function_Reference/is_page Here’s an example from a theme I’m building: if (is_page( array(‘mortgage-calculator’, ‘contact’ ) )){ wp_enqueue_script(‘angularjs’, get_template_directory_uri().’/js/angular.min.js’, array(), ‘1.4.1’, true); wp_enqueue_script(‘d3′, get_template_directory_uri().’/js/d3.min.js’, array(), ’10/22/2015′, true); wp_enqueue_script(‘c3-js’, get_template_directory_uri().’/js/c3.min.js’, … Read more

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