Jump to content
Sign in to follow this  
janpeeters

Using same hook twice, how to control the design result?

Recommended Posts

janpeeters+    31
janpeeters

Hi I've followed the video on 'docs' to bring the search to the header and save space in my menubar. I would also like to place the WPML language selector in that same sector so I thought of using the same hook twice. This gives a strange result, designwise.

	// Add language selector in header
	
	add_action('pagelines_inside_top_branding', 'language_selector');
	function language_selector(){
	do_action('icl_language_selector');
	}
	
	// Add search in header
	
	add_action('pagelines_inside_top_branding', 'new_search');
	function new_search(){
	get_search_form();
	}
	

The result can be seen here: www.janpeeters.nl/blog I would love to have both besides each other. I might need more design control over this. How could I achieve this? Thanks, Jan Thanks Adam for your tip to use a plugin for latest posts on a static page. This works nicely as you can see.

Share this post


Link to post
Share on other sites
cmunns    16
cmunns

The result is likely the same but you can include them in the same function for example: (also for more control wrap them in some html so you can use css to position them ` add_action('pagelines_inside_top_branding', 'language_selector'); function language_selector(){?>

<?php get_search_form();?>
<?php do_action('icl_language_selector');?>
<?php } `

Share this post


Link to post
Share on other sites
janpeeters+    31
janpeeters

Hi Adam, thanks, that helped quite a lot. I added the following CSS which puts everything nicely on the right as you can see in the above URL.

#lang_sel {
	float: right;
	margin-right: 3px;
	margin-top: 1px;
	}
	
	.top_search {
	margin-top: 0px;
	}

What I don't succees at is shoving the two together a bit down so that they optically align with the name of my site. I've tried putting a extra DIV around it named search_lang that I float: right, but what happens then is that the two items are placed under eachother. And not anymore nicely besides eachother. Any idea? Thanks, Jan

Share this post


Link to post
Share on other sites
janpeeters+    31
janpeeters

By the way and how do you manage to have all your code displayed as code in this forym. For the second time only part if my code is displayed as code although the /code is really after the last bit of code.

Share this post


Link to post
Share on other sites
Andrew    201
Andrew

Hey Jan, look like you figured out the code piece... use the `backtick` symbols on the tilde key As to your additional improvements, can't understand. Please post screenshots, and if its a new question, post a new thread.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×