• Resolved etech0

    (@etech0)


    Hi!

    This plugin looks like it will be really useful for me! Is there any way to use conditional logic to decide which page to display, based on a parameter in the URL?

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Paul Ryan

    (@figureone)

    Hm, sounds a little out of scope for this plugin, but you can totally make that work with a little bit of custom javascript in your theme.

    You page would include the shortcode for both pages. Example:

    [insert page='your-first-page' display='all' class='custom-class-for-first-page']
    [insert page='your-second-page' display='all' class='custom-class-for-second-page']

    And the javascript would look something like the following, assuming you’ve defined a custom function called getParameterByName() to get your querystring value (let’s assume it’s show_page=first or show_page=second):
    https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript

    if ( getParameterByName( 'show_page' ) === 'first' ) {
        $( '.custom-class-for-first-page ).show();
        $( '.custom-class-for-second-page ).hide();
    } else if ( getParameterByName( 'show_page' ) === 'second' ) {
        $( '.custom-class-for-first-page ).hide();
        $( '.custom-class-for-second-page ).show();
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Conditional logic to decide which page to display?’ is closed to new replies.