• I’m not using any caching.

    I’ve created two content posts to show randomly and grouped them together. Each is a pair of books from Amazon.com displayed just below the “Escape from Tomorrow” movie poster beneath the blinking eyes near the bottom of the sidebar.

    Your widget is only showing the most recently saved post.

    I’ve tried refreshing, loading different pages, and if I set the “Number of Posts to Show at Once” to 2, it shows both posts, but I only want 1 random post to show.

    https://skewsme.com/tinfoilhat/chapter/esp/

    https://www.ads-software.com/plugins/random-content/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Skews Me

    (@skews-me)

    Hmm… I logged out of WordPress, closed the tabs showing my pages, left for awhile, and when I got back 10 minutes or so later, the older saved post is showing, but only it is, and apparently not switching randomly between them. Then I log back in, and it’s back to showing the most recently saved post. I logged out again, and it’s showing me the 2nd, older post.

    Logged in most recent. Logged out the older one.

    I suppose I should try adding a third post to the group and see what happens before my server locks me out for unusual activity with a 999 error.

    Thread Starter Skews Me

    (@skews-me)

    It looks like it boils down to your WP_Query (orderby’ => ‘rand’) which I don’t know the first thing about.

    You are right its within WP_Query(orderby’ => ‘rand’)
    To explain: rand stands for Random and you can check the meaning of the word “Random” with a dictionary. That is exactly what this function or line of code is doing.

    If you tell the function to display 2 post randomly, it will display both of them at random, if you tell it to display 10 post randomly it will display 10 post at random. In your case, you want 1 post only, so type in “1”.

    You can also check this link: https://www.wpbeginner.com/wp-tutorials/55-most-wanted-wordpress-tips-tricks-and-hacks/
    Go to the Topic that says:
    “2. How to Create a Page that Displays Random Posts”

    And I think you are looking for this line of code or something close to this: query_posts(array(‘orderby’ => ‘rand’, ‘showposts’ => 1));

    So you need to add only this part for 1 post: (‘orderby’ => ‘rand’, ‘showposts’ => 1)

    Thread Starter Skews Me

    (@skews-me)

    I added the (‘showposts’ => 1) into the function call right after (‘orderby’ => ‘rand’) but that didn’t fix it.

    I even checked the added stuff from the random video plugin I have. There don’t seem to be any name clashes.

    Thanks for posting the Plugin Link “random-content” from WordPress. According to random-content Author, you are suppose to specify the number of items you want to randomly post on this line of code:

    To specify the number of posts to show, add the num_posts parameter. For example, [random_content group_id=”13″ num_posts=”3″].
    Link: https://www.ads-software.com/plugins/random-content/

    So, first add the number of: group_id somewhere in your code or try to find this line within your code: [random_content group_id=”13″ num_posts=”3″].

    Then set or change num_posts=”1″ and not “3”.

    For further information, read “Using a shortcode” on: https://www.ads-software.com/plugins/random-content/
    Also note that “num_posts” is the same as saying “showposts”.

    Thread Starter Skews Me

    (@skews-me)

    I haven’t tried using the shortcodes yet within the blog posts. My issue is with the widget not showing random content posts randomly.

    The widget seems to only show one random content post, and it seems to choose between the two I have so far such that when I’m logged in one appears, but when I’m logged out the other appears.

    If I set it to show two of the random content posts, then it shows both at the same time which isn’t what I want.

    Can you post the Widget code here. It looks like there is an iframe or a CSS div that allows you to post two images or adverts on the same div or iframe. If it is a widget or a display issue, then it should only have one div and not two div within one div.

    Two div within a div, will display two adverts and one div within a div will display only one advert.

    Thread Starter Skews Me

    (@skews-me)

    Here’s the plugin code:

    https://www.ads-software.com/plugins/random-content/

    This is the HTML that appears on my page:

    <li id="endo_wrc_widget-2" class="widget widget_endo_wrc_widget"><div class="widgetblock"><table class="float-center" cellpadding="0" cellspacing="0">
    <tr>
    <td><iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=ss_til&ad_type=product_link&tracking_id=skewsmecollec-20&marketplace=amazon&region=US&placement=0060110163&asins=0060110163&linkId=HCN5QAO5FL3WLXX6&show_border=true&link_opens_in_new_window=true"></iframe><iframe style="width:120px;height:240px;" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ss&ref=ss_til&ad_type=product_link&tracking_id=skewsmecollec-20&marketplace=amazon&region=US&placement=0374534241&asins=0374534241&linkId=NP67RZIKALC35K2O&show_border=true&link_opens_in_new_window=true"></iframe></td>
    </tr>
    </table>
    <p></p>
    			</div></li>
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Widget only shows most recently saved random content post’ is closed to new replies.