WordPress.org

Support

Support » Themes and Templates » How to put transposh flag on the header

How to put transposh flag on the header

  • Hi all, how to put transposh (multiligual plugin) flag on the header area (preferably replacing the tag line position)

    Using a comment in this snippet (using qtranslate in navbar widget) i managed to put the transposh widget in the navbar area

    However what i want to have is the flag instead of dropbox like that.

    I also found a comment in this article suggesting on how to put transposh flag in after header area by changing function.php

    Please somebdy help me how to do this .

    Any suggestion would be appreciated.

    PS: I couldn’t find any snippet or article about transposh in the site. The only multi-language site topic cover so far are:

    This snippet (using polylang)
    This snippet (using qtranslate in menu)

Viewing 15 replies - 1 through 15 (of 15 total)
  • If somebody need a link to my site .. click here

    ElectricFeet
    Participant

    @electricfeet

    From the screenshots of transposh, it seems that the widget has several settings, one of which is flags. You should start there.

    Silly me … I now know how to show the flag

    But my placement problem is not resolved yet … what I want to do is to place the flag on the right top corner of the header.

    Should i use the social link area and make it new widget area using this code in function.php

    // Adds a widget area navbar in header
    if (function_exists('register_sidebar')) {
        register_sidebar(array(
            'name' => 'Extra Widget In Socials',
            'id' => 'extra-widget',
            'description' => 'Extra widget in the social links area',
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '',
            'after_title' => ''
        ));
    }
    // Place the widget area in the social links area
    add_filter ('tc_social_in_header', 'add_my_widget');
    function add_my_widget() {
        if (function_exists('dynamic_sidebar')) {
        dynamic_sidebar('Extra Widget In Socials');
        }
    }

    Or using the after navbar as a new widget area using this code

    // Adds a widget area to house transposh flags. See also accompanying css.
    if (function_exists('register_sidebar')) {
        register_sidebar(array(
            'name' => 'Extra Widget After Navbar',
            'id' => 'extra-widget',
            'description' => 'Extra widget after the navbar',
            'before_widget' => '<div class="widget %2$s" id="%1$s">',
            'after_widget' => '</div>',
            'before_title' => '<h2>',
            'after_title' => '</h2>'
        ));
    }
    
    // Place the widget area after the navbar
    add_filter ('__after_navbar', 'add_my_widget');
    function add_my_widget() {
        if (function_exists('dynamic_sidebar')) {
        dynamic_sidebar('Extra Widget After Navbar');
        }
    }

    I am currently experimenting with the 2nd option and trying to figure out the CSS to put it on the top right based on this snippet.

    is there any other suggestion … maybe php code for creating a new widget area above the navbar?

    ElectricFeet
    Participant

    @electricfeet

    You’re on the right track using the second option. You’ve currently added the following CSS:

    .transposh_flags {
        float: right;
        margin-right: 10px;
    }

    Remove this and instead use:

    .widget.widget_transposh {
        position: relative;
    }
    .transposh_flags {
        position: absolute;
        right: 20px;
        top: 20px;
    }

    The key to all this is understanding absolute and relative positioning. To give yourself absolute control over the positioning of the flags element (with the .transposh_flags class) within the parent widget element (with the .widget.widget_transposh class), the parent element must have a position of relative and the child element must have a position of absolute.

    It took me ages to wrap my head around this concept. It seems counter-intuitive that you have to mess with the parent to get the child to behave … until, that is, you draw parallels with real life—then it’s easy to remember 🙂

    More details here.

    Pete2leftfeet
    Member

    @pete2leftfeet

    Hi, I’ve been experimenting with this as well, and have manged to get the positioning working using the second option in the functions.php

    // Adds a widget area to house qtranslate flags. See also accompanying css.
    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    		'name' => 'Extra Widget After Navbar',
    		'id' => 'extra-widget',
    		'description' => 'Extra widget after the navbar',
    		'before_widget' => '<div class="widget %2$s" id="%1$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>'
    	));
    }
    // Place the widget area after the navbar
    add_filter ('__after_navbar', 'add_my_widget');
    function add_my_widget() {
    	if (function_exists('dynamic_sidebar')) {
    	dynamic_sidebar('Extra Widget After Navbar');
    	}
    }

    Pete2leftfeet
    Member

    @pete2leftfeet

    ……and this in the css file

    .widget.widget_transposh {
        position: relative;
    }
    .transposh_flags {
        position: absolute;
        right: 20px;
        top: 20px;
    }
    Pete2leftfeet
    Member

    @pete2leftfeet

    ….it is in the perfect position, but now the “Flags” or “flags with CSS” doesn’t translate

    I’m using WP4.0

    mohamed_bo
    Member

    @mohamed_bo

    Hi,
    Did you get the solution for this problem. I have the same.
    Please, if you found how to do, could you explain how ?
    I am using the last version of wp.
    Thanks

    mzracer
    Member

    @mzracer

    Hi!

    I’m also wanna switch the default drop-down menu to fags instead. But when i go to my widget, the Transposh widget does only have one style: “default”

    What could be wrong? Im running Transpose version 0.9.6 and WP 4.1

    mohamed_bo
    Member

    @mohamed_bo

    Hi Mzracer,
    The solution is to change a bit the php code, I think that the header php, function php must be touched, maybe style.css also. But I was trying many things but I didn’t find how.
    I hope that some nice person can help us.
    I am using Twenty fourteen them and in other web I am using Blackoot Lite theme.
    In both site I am using the 4.1 WordPress version.
    Please, some help.

    mohamed_bo
    Member

    @mohamed_bo

    With the last update it resolved.
    Thanks anyway.

    mzracer
    Member

    @mzracer

    Thank you mohamed_bo!

    I will try the new update 🙂

    //Fredrik

    I want to change the position of the language/flags from the footer to the header on my website.

    Some say, that when modifying language and translations widgets, you don’t necessary have to make changes in your child theme, because the genuine theme translation settings will not be affected by updates. Is this true?

    And if so, should the modifications of the header settings be carried out in the header.php, function.php or CSS file and where in the code should the changes be positioned?

    I can’t locate any child-theme functions.php file anywhere.

    Thanks….Regards The Newbie….

    BigBlack
    Member

    @bigblack

    Hi guys,
    I’d like to put the widget in the top bar area, above the menu, but I don’t understand how can i put it. Can you help me pls? I tryed to modify function and css but nothing happen.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to put transposh flag on the header’ is closed to new replies.