Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$8
Calling a widget into the header php file??
I want to call the translation widget into the area in the header and replace the search bar. I want to obviously do it without the title which is easy enough, I just don't give it one. But how would I go about ?hooking? into the header?
jezyk.pila.pl
This question has been answered.
Doug Montgomery | 01/21/12 at 10:31pm
Edit
(4) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
01/21/12
10:34pmFahd Murtaza says:Which website url?
- 01/21/12 10:35pm
Fahd Murtaza says:and which translation widget? Please post the url for the plugin
- 01/21/12 10:35pm
Doug Montgomery says:mmmm..... jezyk.pila.pl
- 01/21/12 10:37pm
Doug Montgomery says:www.jezyk.pila.pl
http://transposh.org
- 01/21/12 10:37pm
Fahd Murtaza says:I see you are using this theme.
http://www.elegantthemes.com/gallery/chameleon/ - 01/21/12 10:38pm
Doug Montgomery says:Yes....
On the front page you'll see a translation widget about half way down on the left. I want to pull that widget up into the search bar. - 01/21/12 10:40pm
Fahd Murtaza says:Some coding work needed. Give me admin access in a private message and I will get back to you.
- 01/21/12 10:41pm
Fahd Murtaza says:Looks like the header search form needs to be replaced with the php code which outputs the translation widget. This wont be simple drag and drop I believe.
- 01/21/12 10:59pm
Doug Montgomery says:Ya..I was looking at the code given to me by Luis...I can't make heads or tails of it...
- 01/21/12 10:35pm
-

Last edited:
01/21/12
10:42pmLuis Abarca says:You need to register and create a sidebar in the place you need the widget
Register in functions.php
register_sidebar(array(
'name' => 'HeaderSideBar',
'id' => 'header-sidebar',
'description' => 'Widgets in this area will be shown on the header.',
'before_title' => '<h1>',
'after_title' => '</h1>'
));
Add the place in header.php
dynamic_sidebar('header-sidebar')
Then assign the widget to the sidebarPrevious versions of this answer: 01/21/12 at 10:42pm | 01/21/12 at 10:42pm
- 01/21/12 10:40pm
Doug Montgomery says:Ya, I thought you were going to say something like that...The thing is...I don't know how to 'register' and 'create' a sidebar. php is great to me...
- 01/21/12 10:43pm
Doug Montgomery says:My header.php file....if it helps....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php elegant_titles(); ?></title>
<?php elegant_description(); ?>
<?php elegant_keywords(); ?>
<?php elegant_canonical(); ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/colorpicker.css" type="text/css" media="screen" />
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Kreon:light,regular' rel='stylesheet' type='text/css'/>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie6style.css" />
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript">DD_belatedPNG.fix('img#logo, span.overlay, a.zoom-icon, a.more-icon, #menu, #menu-right, #menu-content, ul#top-menu ul, #menu-bar, .footer-widget ul li, span.post-overlay, #content-area, .avatar-overlay, .comment-arrow, .testimonials-item-bottom, #quote, #bottom-shadow, #quote .container');</script>
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie7style.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie8style.css" />
<![endif]-->
<script type="text/javascript">
document.documentElement.className = 'js';
</script>
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php do_action('et_header_top'); ?>
<div id="container">
<div id="header" class="clearfix">
<a href="<?php bloginfo('url'); ?>">
<?php $logo = (get_option('chameleon_logo') <> '') ? get_option('chameleon_logo') : get_bloginfo('template_directory').'/images/logo.png'; ?>
<img src="<?php echo esc_url($logo); ?>" alt="Chameleon Logo" id="logo"/>
</a>
<p id="slogan"><?php bloginfo('description'); ?></p>
<?php do_action('et_header'); ?>
<?php $menuClass = 'nav';
$menuID = 'top-menu';
$primaryNav = '';
if (function_exists('wp_nav_menu')) {
$primaryNav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) );
};
if ($primaryNav == '') { ?>
<ul id="<?php echo esc_attr($menuID); ?>" class="<?php echo esc_attr($menuClass); ?>">
<?php if (get_option('chameleon_home_link') == 'on') { ?>
<li <?php if (is_home()) echo('class="current_page_item"') ?>><a href="<?php bloginfo('url'); ?>"><?php esc_html_e('Home','Chameleon') ?></a></li>
<?php }; ?>
<?php show_page_menu($menuClass,false,false); ?>
<?php show_categories_menu($menuClass,false); ?>
</ul> <!-- end ul#nav -->
<?php }
else echo($primaryNav); ?>
<div id="additional-info">
<div id="et-social-icons">
<?php
$et_rss_url = get_option('chameleon_rss_url') <> '' ? get_option('chameleon_rss_url') : get_bloginfo('comments_rss2_url');
if ( get_option('chameleon_show_twitter_icon') == 'on' ) $social_icons['twitter'] = array('image' => get_bloginfo('template_directory') . '/images/twitter.png', 'url' => get_option('chameleon_twitter_url'), 'alt' => 'Twitter' );
if ( get_option('chameleon_show_rss_icon') == 'on' ) $social_icons['rss'] = array('image' => get_bloginfo('template_directory') . '/images/rss.png', 'url' => $et_rss_url, 'alt' => 'Rss' );
if ( get_option('chameleon_show_facebook_icon') == 'on' ) $social_icons['facebook'] = array('image' => get_bloginfo('template_directory') . '/images/facebook.png', 'url' => get_option('chameleon_facebook_url'), 'alt' => 'Facebook' );
$social_icons = apply_filters('et_social_icons', $social_icons);
if ( !empty($social_icons) ) {
foreach ($social_icons as $icon) {
echo "<a href='" . esc_url($icon['url']) . "' target='_blank'><img alt='" . esc_attr($icon['alt']) . "' src='" . esc_url($icon['image']) . "' /></a>";
}
}
?>
</div>
<div id="search-form">
<form method="get" id="searchform" action="<?php echo home_url(); ?>/">
<input type="text" value="<?php esc_attr_e('Search this site...', 'Chameleon'); ?>" name="s" id="searchinput" />
<input type="image" src="<?php bloginfo('template_directory'); ?>/images/search_btn.png" id="searchsubmit" />
</form>
</div> <!-- end #search-form -->
</div> <!-- end #additional-info -->
</div> <!-- end #header --> - 01/21/12 10:52pm
Doug Montgomery says:Ok, did I really just do that? I feel like such a rookie...I didn't know it would stretch out like that...sorry about that...
Here's the short version...
<div id="search-form">
<form method="get" id="searchform" action="<?php echo home_url(); ?>/">
<input type="text" value="<?php esc_attr_e('Search this site...', 'Chameleon'); ?>" name="s" id="searchinput" />
<input type="image" src="<?php bloginfo('template_directory'); ?>/images/search_btn.png" id="searchsubmit" />
</form>
...I know this is what I want to replace but I don't know anything about <div>'s or where to place the dynamic_sidebar('header-sidebar').
Just looking at the functions.php...I have no idea where to put the code you gave above. It's literally greek to me.
- 01/21/12 10:40pm
-

Last edited:
01/21/12
11:32pmArnav Joy says:hello can you give me access to your site I will make it , it is just replacing the search form at header and placing the widget there.
- 01/21/12 11:33pm
Arnav Joy says:my skype is : arnav.joy
- 01/21/12 11:42pm
Arnav Joy says:go to functions.php
and the end of the file add these code
register_sidebar(array(
'name' => 'HeaderTranslationWidget',
'id' => 'header-translation-widget',
'description' => 'This widgets is used for the header.',
'before_title' => '<h1>',
'after_title' => '</h1>'
));
and call this at the place where search form is defined
means just replace following code
<div id="search-form">
<form method="get" id="searchform" action="<?php echo home_url(); ?>/">
<input type="text" value="<?php esc_attr_e('Search this site...', 'Chameleon'); ?>" name="s" id="searchinput" />
<input type="image" src="<?php bloginfo('template_directory'); ?>/images/search_btn.png" id="searchsubmit" />
</form>
</div>
with the following code at header.php
<?php dynamic_sidebar('header-translation-widget') ?>
Now just got to Appereance>>Widgets at admin panel and drag drop translation widget to this newlly created widget.
See You!!!
- 01/21/12 11:53pm
Doug Montgomery says:This broke something...take a look....
jezyk.pila.pl - 01/21/12 11:54pm
Arnav Joy says:add the code in functions.php
at the end of the file and just befor the ?> tag - 01/21/12 11:55pm
Arnav Joy says:can you come on skype
arnav.joy
or paste your functions.php here i will make it - 01/21/12 11:56pm
Arnav Joy says:any code in php files must come under <?php --all the code--- ?>
so you have placed that code after the ?>
that's why it is visible at the browser and working as a normal text rather than as a php code - 01/21/12 11:58pm
Doug Montgomery says:I got it...search bar is gone but not widget area in the backend. What am I missing here? hmmm....
- 01/21/12 11:58pm
Doug Montgomery says:I got it...search bar is gone but not widget area in the backend. What am I missing here? hmmm....
- 01/22/12 12:01am
Arnav Joy says:did you placed this in your header.php
<?php dynamic_sidebar('header-translation-widget') ?> - 01/22/12 12:28am
Doug Montgomery says:I want to Vote for you my friend but I'm a newbie here and they won't let me. Thanks for the help and getting it squared away for me.
- 01/22/12 12:32am
Doug Montgomery says:duh...I got it...voted.
- 01/21/12 11:33pm
-
Last edited:
01/21/12
11:44pmDuncan O'Neill says:You could take a completely different tack, and use the
qtranslate plugin
Then all you need to do in the header is place this code where you want it;
if(function_exists('qtrans_generateLanguageSelectCode')) {
// Image Only :'image', Text Ony :'text',Both :'both'
qtrans_generateLanguageSelectCode('image');
}
The plugin allows language switching by use of small image flags, text, or both.
hth,- 01/21/12 11:54pm
Doug Montgomery says:Thanks although gtranslate doesn't allow for saved user correction. Transposh will allow anyone to correct the translation.
- 01/21/12 11:54pm
This question has expired.
idt, Julio Potier, Kannan C, Francisco Javier Carazo Gil, Doug Montgomery voted on this question.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
