WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Sitewide Tags Pages
[resolved] Grabbing Custom Post Type Posts (41 posts)

  1. archersify
    Member
    Posted 2 years ago #

    Hi Ron,

    I appreciate taking your time replying. :) Im not asking you actually to do it for me.. :) What i meant was i will wait for the next version to come up with that feature. Appreciate everything and for this plugin youve made.

  2. BestofNJ.com
    Member
    Posted 2 years ago #

    Ron,

    I have been trying to get this to work all day, with no luck. Here is the code that I thought I had right:

    function my_swt_post_type_filter( $ad_listing ) {
    $ad_listing['ad_listings'] = true;
    return $ad_listing;
    }
    
    add_filter( 'sitewide_tags_allowed_post_types', 'my_swt_post_type_filter' );

    I also tried formatting the code into a plugin and that didn't work either.

    John

  3. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    @John - where do you have that code? It needs to be running on the sub site where the post is being published.

  4. BestofNJ.com
    Member
    Posted 2 years ago #

    Ron, I have that code running on the sub site, in functions.php.

  5. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    Do you have the CPT registered on the tags blog?

  6. BestofNJ.com
    Member
    Posted 2 years ago #

    No, I don't know how to do that. Where do I put it?

  7. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    How are you registering the CPT on the source blog?

  8. BestofNJ.com
    Member
    Posted 2 years ago #

    The CPT came as part of the theme. It is from Classipress. I am not sure how it is registered but it works perfectly. I guess it already registered in the includes/post.php file?

  9. BestofNJ.com
    Member
    Posted 2 years ago #

    Ron, where do I look for that registration. It is not in includes/post.php and I cannot find a post.php file in the theme/includes folder.

    I am going to head over to the Classipress forum and ask the question there.

  10. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    Most likely the theme functions.php. If not there then it would be in one of the include files in the theme.

  11. BestofNJ.com
    Member
    Posted 2 years ago #

    I found it. I just have to figure out the formatting issues now. Here is the block of code where the CPT is registered:

    // register the new post type
        register_post_type( APP_POST_TYPE,
            array( 'labels' => array(
                'name' => __( 'Ads', 'appthemes' ),
                'singular_name' => __( 'Ad', 'appthemes' ),
                'add_new' => __( 'Add New', 'appthemes' ),
                'add_new_item' => __( 'Create New Ad', 'appthemes' ),
                'edit' => __( 'Edit', 'appthemes' ),
                'edit_item' => __( 'Edit Ad', 'appthemes' ),
                'new_item' => __( 'New Ad', 'appthemes' ),
                'view' => __( 'View Ads', 'appthemes' ),
                'view_item' => __( 'View Ad', 'appthemes' ),
                'search_items' => __( 'Search Ads', 'appthemes' ),
                'not_found' => __( 'No ads found', 'appthemes' ),
                'not_found_in_trash' => __( 'No ads found in trash', 'appthemes' ),
                'parent' => __( 'Parent Ad', 'appthemes' ),
                ),

    So far, I have not been able to get anything to work.

    I don't understand the components of the piece of code that I am working with. This did not work:

    function my_swt_post_type_filter( $Ad ) {
    $Ad['Ads', 'appthemes'] = true;
    return $Ad;
    }

    and this did not either:

    function my_swt_post_type_filter( $Ad ) {
    $Ad['Ads'] = true;
    return $Ad;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic