Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ultione

    (@ultione)

    I’ve managed to rework the solution for a possible workaround.
    Add below code to functions.php. And flush your permalink settings (Go to Settings > Permalinks and press save changes to refresh)

    function ontrapage_custom_post_type_mod( $args, $post_type ) {
    	if ( $post_type == "ontrapage" ) {
    		$args['rewrite'] = array( 'slug' => 'o', 'with_front' => false ); //set url so that it does not show anything in front
    	}
    
    	return $args;
    }
    add_filter( 'register_post_type_args', 'ontrapage_custom_post_type_mod', 10, 2 );
    
    function add_ontrapage_custom_rewrite() {
    	add_rewrite_rule('([^/]+)(?:/([0-9]+))?/?$', 'index.php?ontrapage=$matches[1]&page=$matches[2]', 'bottom');
    }
    add_action( 'init', 'add_ontrapage_custom_rewrite' );

    This was tested on a permalink structure of /blog/%postname%

    Thread Starter ultione

    (@ultione)

    Sorry to get everyone’s hopes up.
    The solution will fix the permalink issue for ontrapages but will stuff up normal wordpress pages.

    So please DELETE this solution. Thanks.

    Thread Starter ultione

    (@ultione)

    One thing to add, for users, once you have added the code to your functions.php Make sure that you flush your permalinks.
    Go to Settings > Permalinks and press save changes to refresh.

    Thread Starter ultione

    (@ultione)

    Found a bug in my original solution.
    Please use this code instead

    function ontrapage_custom_post_type_mod( $args, $post_type ) {
    	if ( $post_type == "ontrapage" ) {
    		$args['rewrite'] = array( 'slug' => '/', 'with_front' => false );
    	}
    
    	return $args;
    }
    add_filter( 'register_post_type_args', 'ontrapage_custom_post_type_mod', 10, 2 );

    And for the plugin developer
    'rewrite' => array( 'slug' => '/', 'with_front' => false )

    Once the plugin is updated, the additional code to functions.php will not be required. If left alone, will not cause any issues either.

    With the help of this link

    I was able to modify easy-fancybox.php just below ‘/*Append .fancybox) function*/’ comment code to allow for fancybox to work on newly loaded ajax pages.

Viewing 5 replies - 1 through 5 (of 5 total)