• Resolved steve.eldridge

    (@steveeldridge)


    Your redirection filter in the giveaway.php on line 152 is missing the default variable passed to the filter so that regular posts are now using the default “index.php” rather than a single.php template that should be the default in the template hierarchy.

    function giveaway_template() {<br />
      global $post;</p>
    <p>  if ($post->post_type == 'giveaway') {<br />
        $tpl = dirname( __FILE__ ) . '/giveaway-template.php';<br />
      }<br />
      if (is_post_type_archive('giveaway')) {<br />
        $tpl = dirname( __FILE__ ) . '/giveaway-all.php';<br />
      }</p>
    <p>  return $tpl;<br />
    }

    Passing the variable to the function and returning the variable for all other content types avoids this problem and still works for your plug-in.

    <br />
    function giveaway_template($single_template) {<br />
      global $post;</p>
    <p>  if ($post->post_type == 'giveaway') {<br />
        $single_template = dirname( __FILE__ ) . '/giveaway-template.php';<br />
      }<br />
      if (is_post_type_archive('giveaway')) {<br />
        $single_template = dirname( __FILE__ ) . '/giveaway-all.php';<br />
      }</p>
    <p>  return $single_template;<br />
    }<br />

    Hope you can add this in the next release so we can keep using your latest versions, in the mean time I’ve had to change your code to fix our site.

    Best,

    Steve Eldridge

    https://wordpress.org/plugins/give-it-away-now/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Passing the "single" template’ is closed to new replies.