WordPress.org

Support

Support » Plugins and Hacks » Multisite Language Switcher » [Resolved] Position of "This post is available in…"

[Resolved] Position of "This post is available in…"

  • Hi Realloc,

    your plugin works perfectly on my blog, but I have a little question for you which is related to the looks of it.

    In the following example, you can see that the bio box is too close to the “This post is also available in…” which is underneath it. So it doesn’t look very well.

    You can see it here: http://www.putrumputrum.com/dvd/steve-smith-drum-legacy-standing-on-the-shoulders-of-giants/

    Is there any way to make it go one or two lines down? I’ve tried to find where to add a couple of , but I’m afraid my knowledge about this is really poor.

    Thanks in advance.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Dennis Ploetner

    @realloc

    You can handle all these things with CSS. You could write something like this in your css-file:

    p#msls { clear: left; padding: 1em; }

    Cheers,
    Dennis.

    I thought something like that, but in the “Style.css” from my theme there is nothing like “msls”, so I don’t know where to put it.

    I also tried with the “Style.css” from your plugin but it has no effect.

    Sorry for the silly question, but I know nothing about css coding.

    Plugin Author Dennis Ploetner

    @realloc

    Simply add it to the style.css of your theme (or child theme).

    I did it, but nothing happened. This is what I did first.

    I writted in the “footer section”, like this:

    #pagination a:hover, #pagination span.current {
    background: #ccc;
    p#msls { clear: left; padding: 1em; }
    }

    #pagination .page-numbers{
    background-color: #FFFFFF;
    border-right: 1px solid #EEEEEE;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
    display: block;
    float: left;
    margin-right:3px;
    padding: 4px 8px;
    position: relative;
    }

    These are the last lines of my “Style.css”. I’m sure I’m doing something stupidly wrong, but I don’t know what it is

    Plugin Author Dennis Ploetner

    @realloc

    It can be necessary to flush the browser cache ([STRG] + F5).

    Plugin Author Dennis Ploetner

    @realloc

    This would be the correct css:

    #pagination a:hover, #pagination span.current {
            background: #ccc;
    }
    #pagination .page-numbers{
            background-color: #FFFFFF;
            border-right: 1px solid #EEEEEE;
            box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
            display: block;
            float: left;
            margin-right:3px;
            padding: 4px 8px;
            position: relative;
    }
    p#msls { clear: left; padding: 1em; }

    Yes, I did it, again and again. Nothing.

    No, wait!

    It’s ok, I didn’t see your last post

    Works perfectly

    Thank you very much, awesome!

    Plugin Author Dennis Ploetner

    @realloc

    Very good. You’re welcome.

    Cheers,
    Dennis.

    Hi realloc,
    I have a similar question to Goodvalley, but I’m not sure if CSS is the right fix:

    Is there a way to move the “this post is available in…” link to the top of the post so that readers who cannot read the current language knows to switch over to the other language without scrolling down?

    I’ve played with the CSS (using position: absolute) and tried to hunt down the right php file where the multisite language link gets inserted, but haven’t found success…

    Plugin Author Dennis Ploetner

    @realloc

    In the current version it is just possible with some lines of PHP in the functions.php. Would this be a problem for you?

    Hi realloc,

    I managed to achieve the desired result by changing the
    function msls_content_filter( $content ) in MultisiteLanguageSwitcher.php to:

    /**
         * Filter for the_content()
         *
         * @package Msls
         * @uses MslsOptions
         * @uses MslsOutput
         * @param string $content
         * @return string
         */ 
    
        function msls_content_filter( $content ) {
            if ( !is_front_page() && is_singular() ) {
                $options = MslsOptions::instance();
                if ( $options->is_content_filter() ) {
                    $obj   = new MslsOutput();
                    $links = $obj->get( 1, true, true );
                    if ( !empty( $links ) ) {
                        if ( count( $links ) > 1 ) {
                            $last  = array_pop( $links );
                            $links = sprintf(
                                __( '%s and %s', 'msls' ),
                                implode( ', ', $links ),
                                $last
                            );
                        } else {
                            $links = $links[0];
                        }
                        $content = '<p id="msls">' .
                            sprintf(
                                __( 'This post is also available in %s.', 'msls' ),
                                $links
                            ) .
                            '</p>' . $content;
                    }
                }
            }
            return $content;
        }
        add_filter( 'the_content', 'msls_content_filter' );

    But it seems like I can’t override the function in a plugin in functions.php without modifying the plugin file (ie. commenting out your original function). If there’s a way to override it without changing your plugin file, then I can update your plugin without worrying… any hint there?

    Plugin Author Dennis Ploetner

    @realloc

    You could remove my filter and then add yours.

    remove_filter( 'the_content', 'msls_content_filter' );
    add_filter( 'the_content', 'my_msls_content_filter' );
    
    function my_msls_content_filter() {
        ...
    }

    Works like a charm. Thanks realloc!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] Position of "This post is available in…"’ is closed to new replies.
Skip to toolbar