• Resolved Fotis

    (@markwaregr)


    Hi there,
    Can we apply the plugin function only for a certain page template, and disable it for other posts pages etc?

    Thank you for this great plugin.

    • This topic was modified 4 years, 9 months ago by Fotis.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Fotis

    (@markwaregr)

    Hi again,
    well I noticed you have a solution, but only for custom post types, so it will be great to have a filter for pages/templates etc. For now I made this change in the code of the plugin
    Replaced in frontend/class-custom-permalinks-form.php this

       $excluded = apply_filters( 'custom_permalinks_exclude_post_type', $exclude_post_types );
    

    with

    
      $excluded = get_page_template_slug($post->ID)=="templates/page-rides-seo7.php" ? false : true;

    and

    if("__true"===$excluded) {

    with

    
        if ( true === $excluded ) {
    

    in all two instances.

    Let me know if I am missing something

    • This reply was modified 4 years, 9 months ago by Fotis.
    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @markwaregr

    First of all, Sorry for the delay in my response.

    This filter custom_permalinks_exclude_post_type works for all the Post Types (Post, Page, and custom). I am not sure why you didn’t find it working in pages. I would like to assist you if you are still interest in the proper solution while having plugin up-to-date.

    Regards,
    Sami

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @markwaregr

    I have added another filter by using that you can achieve the same thing what you have done by customizing the plugin.

    In the below-mentioned example, Custom Permalinks will only work on this template “templates/page-rides-seo7.php”.

    
    function yasglobal_exclude_posts( $post )
    {
        if ( get_page_template_slug( $post->ID ) == "templates/page-rides-seo7.php" ) {
            return false;
        }
    
        return true;
    }
    add_filter( 'custom_permalinks_exclude_posts', 'yasglobal_exclude_posts' );
    

    NOTE: This filter is going to be available in v1.6.0.

    Regards,
    Sami

    Thread Starter Fotis

    (@markwaregr)

    @sasiddiqui You are awesome!

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi @markwaregr

    Custom Permalinks v1.6.0 is officially released. Please update to the latest version to use the above-mentioned filter.

    Regards,
    Sami

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Apply the plugin only in certain page template’ is closed to new replies.