WordPress.org

Ready to get started?Download WordPress

Forums

single_template filter is missing. (6 posts)

  1. david85allen@googlemail.com
    Member
    Posted 2 years ago #

    Hi can some one confirm that the single_template filter is now missing in v3.4 and what i can use instead....

    Many Thanks

    Dave

  2. bcworkz
    Member
    Posted 2 years ago #

    It is indeed gone. All of the filters in the various get_???_template() functions have been removed. Not sure a workaround exists.

  3. david85allen@googlemail.com
    Member
    Posted 2 years ago #

    Why have they got rid of them. It doesn't make any sense.

    I hope someone can help with a workaround.

  4. Arie Putranto
    Member
    Posted 2 years ago #

    Is it? I notice that there is still filter {$type}_template in wp-includes/template.php (Line: 28)

  5. John RAMP
    Member
    Posted 1 year ago #

    Hi All, same problem.

    Now I am using below code for load the template for my custom post type from my plugin folder.

    function (My_Custom_Post_Type)_template($single_template) {
         global $post;
    
         if ($post->post_type == '{My_Custom_Post_Type}') {
              $single_template = dirname( __FILE__ ) . '/templates/{My_Custom_Post_Type}-template.php';
         }
         return $single_template;
    }
    
    add_filter( "single_template", "{My_Custom_Post_Type}_template" );

    How could I replace the above "single_template" filter.

    How could I have use this {$type}_template?

    Please help!

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  6. esmi
    Forum Moderator
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags