WordPress.org

Forums

Customizr
How to put transposh flag on the header (16 posts)

  1. sugaboss
    Member
    Posted 1 year ago #

    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)

  2. sugaboss
    Member
    Posted 1 year ago #

    If somebody need a link to my site .. click here

  3. ElectricFeet
    Member
    Posted 1 year ago #

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

  4. sugaboss
    Member
    Posted 1 year ago #

    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.

  5. sugaboss
    Member
    Posted 1 year ago #

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

  6. ElectricFeet
    Member
    Posted 1 year ago #

    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.

  7. Pete2leftfeet
    Member
    Posted 8 months ago #

    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');
    	}
    }
  8. Pete2leftfeet
    Member
    Posted 8 months ago #

    ......and this in the css file

    .widget.widget_transposh {
        position: relative;
    }
    .transposh_flags {
        position: absolute;
        right: 20px;
        top: 20px;
    }
  9. Pete2leftfeet
    Member
    Posted 8 months ago #

    ....it is in the perfect position, but now the "Flags" or "flags with CSS" doesn't translate

    I'm using WP4.0

  10. mohamed_bo
    Member
    Posted 6 months ago #

    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

  11. mzracer
    Member
    Posted 6 months ago #

    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

  12. mohamed_bo
    Member
    Posted 6 months ago #

    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.

  13. mohamed_bo
    Member
    Posted 5 months ago #

    With the last update it resolved.
    Thanks anyway.

  14. mzracer
    Member
    Posted 5 months ago #

    Thank you mohamed_bo!

    I will try the new update :)

    //Fredrik

  15. Gerdes
    Member
    Posted 5 months ago #

    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....

  16. BigBlack
    Member
    Posted 3 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic