• Resolved rudtek2

    (@rudtek2)


    Hi Andy,
    Is there any way that i can have the destination page show my posts before i click on a yearly link?

    Right now I load the links shortcode in the sidebar and put my shortcode 2 on a page “press releases”. When a visitor goes to this page it’s blank and they have to click a year (2018 etc) before any posts are loaded.

    Is there any way to load the posts as they get to the page. Either all posts, unfiltered or the most recent year etc?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author AndyWarren

    (@awarren)

    You would need to write a custom query to display the posts on that page, and then replace them with the yearly archive posts. This isn’t something built into the plugin.

    Thread Starter rudtek2

    (@rudtek2)

    any general idea on the hook or if i could use? ie… If shortcode has no data show rt_new_query, else show shortcode?

    Thread Starter rudtek2

    (@rudtek2)

    maybe if $_GET is empty?

    Plugin Author AndyWarren

    (@awarren)

    Honestly the way the plugin is written there isn’t really a way to natively do it. You’d have to probably get into the template file and do a conditional maybe checking if the year query string parameter is present, and if not show all posts with a custom query, but if the year parameter is present then render the shortcode.

    Thread Starter rudtek2

    (@rudtek2)

    i got it working how i want it.

    I replaced this line:
    if ($_SERVER["QUERY_STRING"] == $postdate) {

    to this

    	if ($_SERVER["QUERY_STRING"]) {
    		$date2use =  $_SERVER["QUERY_STRING"];
    }else {
     $date2use = date("Y");
    }
    	if ($date2use == $postdate) { 

    it now loads the current year (as set by php ) if you don’t have the shortcode pushing a query.

    • This reply was modified 6 years, 6 months ago by rudtek2.
    Plugin Author AndyWarren

    (@awarren)

    That works, just remember it will get overwritten if you update the plugin. I’ll mark this resolved for now, please feel free to reopen if you need to.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘show posts on page before clicking year link’ is closed to new replies.