Shortcodes

This topic contains 6 replies, has 3 voices, and was last updated by  Guust 5 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #457703

    Carin Handsun
    Expired Member
    Post count: 178

    Is it possible to extract Place CPT meta data in using shortcodes without being on one of the GD Template Pages? I am trying to show a list of Place Business Names with their City,State Location and Number of Events that are Current

    #457709

    Guust
    Moderator
    Post count: 29970

    In V1 you would use the [gd_listings] shortcode:
    https://wpgeodirectory.com/docs/core-shortcodes/#listings

    In V2 you would use the the same shortcode [gd_listings], but some parameters may be different.

    Adding the number of events linked to the will require custom coding.

    Thanks

    #457712

    Carin Handsun
    Expired Member
    Post count: 178

    I am able to get the [gd_listings], pulling names of Places, but what is not working is post meta to pull in address, I guess that only works on the Template pages, that was my original question, how else could I have an alphabetical list of Places with addresses?

    #457715

    Guust
    Moderator
    Post count: 29970

    Did you add the Address custom field to the “Listings page” output location?

    Thanks

    #457748

    Carin Handsun
    Expired Member
    Post count: 178

    Actually I got it, I added post meta address to my Archive Detail template, I was trying to create a standalone page with shortcode which is not how the GDirectory works! (slowly getting educated)

    So to add Number of Events by Author (Place) to the List I tried using the gd_linked_posts but do not know how to make it display in a number of rather than a layout of actual posts, am I on the right track by trying something like this: (I just want to check with you before I take it to my developer, to make sure I am not overcomplicating it.

    
    
    <?php
    function count_user_posts_by_type( $userid, $post_type = 'post' ) {
    	global $wpdb;
    
    	$where = get_posts_by_author_sql( $post_type, true, $userid );
    
    	$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
    
      	return apply_filters( 'get_usernumposts', $count, $userid );
    }
    ?>
    #457775

    Alex Rollin
    Moderator
    Post count: 27815

    Hi Carin,

    We are unable to provide support for V2 customizations at this time because we are focused on getting all the addons ready and released.

    #457787

    Guust
    Moderator
    Post count: 29970

    I was trying to create a standalone page with shortcode which is not how the GDirectory works! (slowly getting educated)
    That is incorrect. The [gd_listings] shortcode works on any page.

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket