Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

HarroH on "Hack wp_head"

$
0
0

Hi All,

I'm trying to affect the wp_head to change to that one of another page. However, the normal workaround of wp_query is not working here. Any suggestions how I can get the wp_head of another page by its slug or ID?

I have this now:

$page_for_head = get_page_by_path( $redirect );

$temp_query = $wp_query;

$page_args = array(
	'post_type'		=>	'page',
	'page_id'		=> 	$page_for_head->ID
);

$wp_query = new WP_Query( $page_args );

while ( have_posts() ) : the_post();

	wp_head();

endwhile;

$wp_query = $temp_query;

But this just returns the wp_head of the main page. Thanks in advance.


Viewing all articles
Browse latest Browse all 8245

Trending Articles