• Resolved raoulunger

    (@raoulunger)


    Say:

    • I have a pod ‘projects’ with 4 fields;
    • and I have two different templates: the first showing fields 1+2, and the second showing fields 3+4 (of a ‘project’);
    • I use auto-template to show the content of one project, using the first template (so only showing the content of fields 1+2).

    My question is: when viewing a project as defined by template one, is there a way (for example: a link in that first template) that would allow the visitor to switch to the same project, but now according to template two (so only showing the content of fields 3+4)?

    Hope I’m making myself clear!
    Thanks!

    • This topic was modified 1 year, 1 month ago by raoulunger.
    • This topic was modified 1 year, 1 month ago by raoulunger.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @raoulunger,

    From what I understand you want to change the template based on URL (get) parameters.

    You ca use custom hooks and change the template, for example:

    add_filter( 'pods_auto_template_template_name', function( $current_template ) {
        if (
            'FIRST_TEMPLATENAME' == $current_template
            && isset( $_GET['PARAMNAME'] )
            && 'PARAMVALUE' === $_GET['PARAMNAME']
        ) {
            return 'SECOND_TEMPLATENAME';
        }
        return $current_template;
    } );

    Cheers, Jory

    Thread Starter raoulunger

    (@raoulunger)

    Thank you! I will give that a try.

    Cheers, Raoul

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Qustion about link between pods templates’ is closed to new replies.