Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Keryn

    (@b-summers)

    The page id seems to work, but not the slug

    [insert page=’8′ display=’all’]

    instead of

    [insert page=’services’ display=’all’]

    Plugin Author Paul Ryan

    (@figureone)

    If you have two pages/posts/media objects with the same slug, this can happen. The plugin looks up the slug using get_page_by_path(), so if there’s overlap it doesn’t know which object you’re referring to. IDs are the safe way, since they are unique across all object types.
    You can set it to default to page IDs instead of slugs in the plugin options (Dashboard > Settings > Insert Pages).

    Thread Starter Keryn

    (@b-summers)

    Thanks for that information Paul. It was a brand new install of WordPress with only 4 pages and no posts so I can’t see there being any overlap in slugs, but I’ll just use ID’s as default from now on, it works great ??

    I had the same issue due to a collistion between page “contact” and menu entry “contact”.
    I would prefere to not use page id, I would propose adding ‘type’ attribute and following simple plugin modification:
    (insert-pages.php:111)

    $attributes = shortcode_atts( array(
    		'page' => '0',
    		'display' => 'all',
    		'class' => '',
    		'inline' => false,
    		'type' => 'all',
    	), $atts );

    (insert-pages.php:183)

    $types = $attributes['type'];
    	if ($attributes['type'] == 'all') {
    		$types = get_post_types();
    	}
    
    	// Get the WP_Post object from the provided slug or ID.
    	if ( ! is_numeric( $attributes['page'] ) ) {
    		$inserted_page = get_page_by_path( $attributes['page'], OBJECT, $types );

    Plugin Author Paul Ryan

    (@figureone)

    Instead of making type a parameter (which I think introduces needless complexity), I will probably try to filter attachment, revision, and nav_menu_item out of the list of post types retrieved from get_page_by_path(). I can’t see any meaningful case where they would need to be embedded with this plugin anyway.

    Will keep you guys updated.

    Plugin Author Paul Ryan

    (@figureone)

    Version 3.1.3 will be released shortly with this fix. @b-summers, let me know if this addresses your original issue with inserting via page slugs. Thanks @k7f7 for tracking down the collision!

    https://github.com/uhm-coe/insert-pages/commit/d24c216429a13021753a106e3d7bafc6a698333a

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Only Displaying Page titles’ is closed to new replies.