• Resolved veenavinu

    (@veenavinu)


    Hi,

    My AMP blog page not working with permalink manager plugin. If i deactivate its working well.
    The issue am facing right now is when i click “show more posts” link in my blog posts page – indeed the page is navigating to page 2 but contents are not changing.

    How can i resolve this?
    BTW am using AMP for WP plugin.

    I

    • This topic was modified 3 years, 7 months ago by veenavinu.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @veenavinu,

    Could you provide me with a sample blog URL?

    Plugin Author Maciej Bis

    (@mbis)

    Hi @veenavinu,

    Please ignore my previous commnent.

    I prepared a temp. snippet that makes my plugin support “AMP for WP” plugin. It will be added to the plugin’s codebase in the next release.

    function pm_detect_amp_pagination($request) {
    	global $wp_rewrite, $pm_query;
    
    	if(!defined('AMPFORWP_AMP_QUERY_VAR')) {
    		return $request;
    	}
    
    	$amp_endpoint = AMPFORWP_AMP_QUERY_VAR;
    	$paged_endpoint = $wp_rewrite->pagination_base;
    
    	if(!empty($pm_query['endpoint']) && strpos($pm_query['endpoint_value'], "{$paged_endpoint}/") !== false) {
    		$paged_val = preg_replace("/({$paged_endpoint}\/)([\d]+)/", '$2', $pm_query['endpoint_value']);
    
    		if(!empty($paged_val)) {
    			$request[$amp_endpoint] = 1;
    			$request['paged'] = $paged_val;
    		}
    	}
    
    	return $request;
    }
    add_filter('permalink_manager_filter_query', 'pm_detect_amp_pagination', 5, 2);

    Please paste the code to functions.php file in (child) theme directory.

    Thread Starter veenavinu

    (@veenavinu)

    Hey it worked like a charm.. Thank You.

    And Thank You so much for your swift response.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘permalink manager plugin not working with amp’ is closed to new replies.