WordPress.org

Ready to get started?Download WordPress

Forums

Multisite Language Switcher
[resolved] Position of "This post is available in..." (17 posts)

  1. Goodvalley
    Member
    Posted 1 year ago #

    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.

  2. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Goodvalley
    Member
    Posted 1 year ago #

    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.

  4. realloc
    Member
    Plugin Author

    Posted 1 year ago #

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

  5. Goodvalley
    Member
    Posted 1 year ago #

    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

  6. realloc
    Member
    Plugin Author

    Posted 1 year ago #

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

  7. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    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; }
  8. Goodvalley
    Member
    Posted 1 year ago #

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

  9. Goodvalley
    Member
    Posted 1 year ago #

    No, wait!

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

    Works perfectly

    Thank you very much, awesome!

  10. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    Very good. You're welcome.

    Cheers,
    Dennis.

  11. drbillylin
    Member
    Posted 1 year ago #

    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?

  12. drbillylin
    Member
    Posted 1 year ago #

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

  13. realloc
    Member
    Plugin Author

    Posted 1 year ago #

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

  14. drbillylin
    Member
    Posted 1 year ago #

    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?

  15. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    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() {
        ...
    }
  16. drbillylin
    Member
    Posted 1 year ago #

    Works like a charm. Thanks realloc!

  17. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    Very good! Cheers,
    Dennis.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.