Articles of headers

wp_head() – list hooked actions with priorities?

I’d like to add something to wp_head() but I’m aiming precise location (like after style.css but before rtl.css and before my other custom script). I’m wondering if it’s possible to list everything that is attached to wp_head() in execution/display order anyhow? I know that I can pass priority/order parameter to add_action but I need to […]

if/else on custom query gives 200 OK when condition not met?

What? I am modifying my theme to show comments of a post on a separate page. How? Mostly based on this answer but with improved checks and code. So this is what my page-comments.php (kinda) looks like: (The code is very easy to scan through, trust me!) <?php get_header(); ?> <?php /* * (Example URL: […]

Sharing Header Components Across Multisite

I have a multi-site platform and I’m trying to share the menu that I have in main with other sites that are located in different folders. This is the PHP tag in the main that pulls the menu which I also need in the header of other: <?php dokan_header_user_menu(); ?> I tried using it as […]

Remove sticky behavior from top navigation on twenty fourteen theme?

In wordpress theme twentyfourteen, I am wondering how to remove the sticky behavior of the top navigation with a 100% width header background image like this site? I would love to have a top image with full width and a max-height with the navigation just placed under it, but the navigation sticks to the top […]

How to load a jQuery script last?

How to get this to load last? <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(“div.domTip_tipBody”).mouseover(function(){ jQuery(“#yyy a.tippy_link”).css(“background-color”,”yellow”);});   jQuery(“div.domTip_tipBody”).mouseout(function(){ jQuery(“#yyy a.tippy_link”).css(“background-color”,”red”); }); });   </script> It is running before “div.domTip_tipBody” is being run (which is generated by a shortcode) so nothing happens. I have tried: <script src=”script.js” type=”text/javascript” defer=”defer”></script> in my header.php before </head> but it doesn’t help. Have […]

custom headers for static home page and posts page

have a site w/a static home page and a posts page and then a number of other static pages – i set up a custom header for the home page and then another all other pages like this in the header <?php if(is_home()){ include(TEMPLATEPATH.’/header_front.php’);} else { include(TEMPLATEPATH.’/header_default.php’);} ?> it works perfectly except that the posts […]

Programmatically log in a wordpress user

I am trying to programmatically log in a wordpress user, using the following function for that. public function auto_login( $user ) { $username = $user; if ( !is_user_logged_in() ) { $user = get_user_by( ‘login’, $username ); wp_set_current_user( $user->ID, $user->user_login ); wp_set_auth_cookie( $user->ID ); do_action( ‘wp_login’, $user->user_login ); } } Unfortunately it seems not to be […]

Force wp_enqueue_scripts to the HEADER?

A plugin I’m working on requires jquery to be loaded before the content is processed. Some stock themes, like 2010, 2011 and 2012 (I believe) put the JS in the footer. How can I force the scripts to be loaded in the header (I will notify users of the plugin that the plugin requires this)?

The plugin generated 80 characters of unexpected output!

I’m getting this message each time I activate my plugin: The plugin generated 80 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. The only way I can suppress the message is to wrap my activation function code […]

How to load a different header based on post format?

I have a difficult question. What’s the best way to load a different header based on a post format? I guess I could load another loop around the header but I noticed the site does slow down. This is the code on my index.php: <?php get_header();?> <section id=”block”> <?php if ( have_posts() ) : while […]