• Resolved Dan

    (@wkndwlk)


    Hi Joe,

    Is it possible to have an option when using a collection shortcode such as below, that all the maps associated with that collection are listed underneath the initial collection map?

    [Waymark collection_id="27"]

    Essentially, I would like the shortcode to show everything you would see when visiting a collection URL such as: https://www.waymark.dev/collection/demo-collection/

    Compared with the shortcode view which doesn’t list each associated map underneath: https://www.waymark.dev/docs/collections/

    Hope that makes sense?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Joe

    (@morehawes)

    Hi @wkndwlk,

    Essentially, I would like the shortcode to show everything you would see when visiting a collection URL such as: https://www.waymark.dev/collection/demo-collection/

    I like this idea. I will have a think about how this could be integrated through the Shortcode.

    While it’s not exactly what you asked for, and requires making edits to your WordPress theme; because Waymark uses custom WordPress post types and taxonomies you can achieve things like this through your theme.

    For example, I have updated the Collection archive page on the Waymark site to display a single Map featuring all Maps in that Collection at the top of the page. Underneath lists the Maps individually, as before.

    To do this I created a file named taxonomy-waymark_collection.php in my theme directory and copied the content from index.php (or archive.php if you have one) and added the following line at the top:

    <!-- Shortcode with all Maps in Collection -->
    <?php echo do_shortcode('[Waymark shortcode_header="0" collection_id="' . get_queried_object()->term_id . '"]'); ?>

    This could be taken further to loop over and display each Map individually.

    I hope this helps and I will update if/when I make any progress displaying this kind of content through the Shortcode.

    Cheers,

    Joe

    Thread Starter Dan

    (@wkndwlk)

    Hi Joe,

    Thanks for the update, but your link to the Collection Archive page is 404ing for me?

    I will explore the solution you suggest. Thanks

    Plugin Author Joe

    (@morehawes)

    Hi @wkndwlk,

    Thanks for letting me know. Fixed ??

    Joe

    Thread Starter Dan

    (@wkndwlk)

    Thanks Joe, I see what you mean now.

    Final question on this from me would be:

    Do you have a workaround to display a Collection Archive page as the homepage?

    I have created an “all maps” Collection which I plan to simply add the shortcode to the homepage, however as discussed in this thread, ideally this would include each individual map in the collection.

    Therefore, instead if I could simply make the Collection Archive page appear as my homepage, that would work.

    Dan

    Plugin Author Joe

    (@morehawes)

    Hi @wkndwlk,

    Do you have a workaround to display a Collection Archive page as the homepage?

    Not easily, however you could modify (or create based on index.php) your theme front-page.php and add something like:

    <?php get_header();?>
    
    <?php
    // Your Collection ID
    $collection_id = 4;
    
    get_header();?>
    
    
    <?php
    
    echo do_shortcode('[' . Waymark_Config::get_item('shortcode') . ' collection_id="' . $collection_id . '"]');
    
    $maps = get_posts(array(
    	'posts_per_page' => -1, // All!
    	'post_type' => 'waymark_map',
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'waymark_collection',
    			'field' => 'term_id',
    			'terms' => $collection_id,
    		),
    	),
    ));
    
    //Has Maps
    if (sizeof($maps)) {
    	foreach ($maps as $map) {
    
    		echo do_shortcode('[' . Waymark_Config::get_item('shortcode') . ' map_id="' . $map->ID . ' map_width="320" map_height="240"]');
    	}
    }
    ?>
    
    <?php map_first_archive_pagination();?>
    
    <?php get_sidebar();?>
    <?php get_footer();?>
    

    Just a rough example – but hopefully that helps ??

    Cheers,

    Joe

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Collection Shortcode – Include Walk Details’ is closed to new replies.