Can't overwrite with custom content within single post / Question about slick

Home Forums Product Support Forums Related Posts Pro for WordPress Support Can't overwrite with custom content within single post / Question about slick

This topic contains 3 replies, has 2 voices, and was last updated by Birgnemo Birgnemo 7 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10851
    Birgnemo
    Birgnemo
    Participant

    Greetings, I have two questions. I hope, you can provide a solution.

    1. Question

    I’am trying to overwrite the related posts shown in respect to the global configuration in favor of custom content within certain posts in the admin view. So I want to override locally if you will.

    It doesn’t work in my local server installation when choosing custom content. Somehow a possibly cached version of undefinable origin is shown and I can’t change it. I tried to switch off the plugin cache and tried to figure out if I did some weird configuration mistake, but the problem still occurs.

    I found another ticket concerning this topic, but couldn’t figure out, what to do to fix this:
    https://wp-dreams.com/forums/topic/local-custom-override-not-working/

    I already tried to change the theme because there is a layout builder incorporated that comes with the enfold theme. I also switched off other plugins temporary. With no success.

    I switched on the debug mode of wp and this line was shown multiple times on screen:
    Notice: Undefined property: stdClass::$ttid in /Applications/MAMP/htdocs/yello-contenthub/wp-content/plugins/related-posts-pro/includes/related_content.class.php on line 1389

    Can you give me advice how to solve this problem?

    2. Question
    I have a second question concerning the slick and slide layout. I want to arrange the carousel so, that four posts are shown on screensize min 1200px, 3 columns on the next smaller viewport, then 2 and finally 1 on mobile. So I set image size to 25% in the plugin configuration.
    Now it occurs, that the related posts plugin will show 4 columns of posts no matter what browser-screen-width I load the page. Sometimes it only shows 1 slide-column, on reload it will show 4 again.

    Is there a possibility to show a “responsive” amount of columns the same way it works, when I change the Browser-Width manually (resize)? Basically that’s the initial responsive behaviour I would expect when I visit the Site with a smaller viewport.

    Currently the plugin will try to alway show 4 columns initially even in Mobile Viewport and add columns or substract columns when resizing. Is this behaviour familiar to you and can you give me feedback on this?

    #10900
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    1. I recall it was something with the de-coding of the custom based content, but we weren’t able to tell what it was caused by, and why.
    I think however I might be able to suggest a solution, but it involves editing the plugin source, so have a back-up just in case.

    Open up the wp-content\plugins\related-posts-pro\includes\shortcodes.php file and scroll to lines 66-67, which should be:

    if (isset($rpp_data['selected-customcontent']) && count($rpp_data['selected-customcontent']) > 0)
        $defaultContent = $rpp_data['selected-customcontent'];

    and replace those lines with this:

    if ( isset($rpp_data['customcontent']) ) {
        $rpp_data['selected-customcontent'] = explode('|', $rpp_data['customcontent']);
        foreach ($rpp_data['selected-customcontent'] as $kk => &$vv)
            $vv = json_decode(base64_decode($vv), false);
        unset($vv);
    }
    if (isset($rpp_data['selected-customcontent']) && count($rpp_data['selected-customcontent']) > 0)
        $defaultContent = $rpp_data['selected-customcontent'];

    This should solve it hopefully.

    2. In this case I think you are better off by defining a pixel width, instead of a percentage one I believe.

    The slick and slide scripts tries to resize the elements in a way that always a “whole” number of items are displayed. So the size defined there is just a starting point.

    Another possible solution might be to use media queries to override the initial widths. These will only apply when the page is reloaded with a different size – as the slick layout parses the initial width on page load. I haven’t actually tried this, but I would do something like this:

    @media only screen and (max-width: 1200px)  {
      div[id^="relatedpostspro_0_"].rpp_slick .rpp_item {
          width: 33%;
      }
    }
    
    @media only screen and (max-width: 780px)  {
      div[id^="relatedpostspro_0_"].rpp_slick .rpp_item {
          width: 50%;
      }
    }
    
    @media only screen and (max-width: 320px)  {
      div[id^="relatedpostspro_0_"].rpp_slick .rpp_item {
          width: 100%;
      }
    }

    I’m not sure if these will work, but the slick script should get the variable values based on the screen size.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #10925
    Birgnemo
    Birgnemo
    Participant

    Thank you very much for your reply.

    I added (rpp_data[‘override’] == 1) to your code-snippet:

                if (isset($rpp_data['selected-customcontent']) && count($rpp_data['selected-customcontent']) > 0 && $rpp_data['override'] == 1)
                    $defaultContent = $rpp_data['selected-customcontent'];

    This let’s the override button on the sindle post react the way intended. OFF and ON was switched in functionality without the addition.

    Seems like it works now. Thank you very much for the hint.

    Concerning the Responsive behaviour of the slick slider I tried to find an image width, that somehow works as supposed. The media queries don’t work I am afraid.

    Thank you for the support. Please leave the ticket open until I have tested everything and am shure, there are no more questions concerning this topic.

    #10989
    Birgnemo
    Birgnemo
    Participant

    Seems to work now. Thank you for your support. You may close this ticket.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Can't overwrite with custom content within single post / Question about slick’ is closed to new replies.