How to get custom post type pages excerpts in 'store_page' archive?

Home Forums Store Locator Plus How to get custom post type pages excerpts in 'store_page' archive?

This topic contains 6 replies, has 3 voices, and was last updated by  Lïncheran 1 year, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #27908

    Lïncheran
    Participant

    Hi,

    i created a “store_page” archive with the following function:

    function namespace_add_custom_types($query) {
    if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) {
    if ( !is_post_type_archive() && $query->is_archive() && $post_type != ‘store_page’ )
    $query->set( ‘post_type’, array(‘post’, ‘nav_menu_item’, ‘store_page’) );
    return $query;
    }
    }
    add_filter( ‘pre_get_posts’, ‘namespace_add_custom_types’ );

     

    The archive show only the title of each store page and i need to show also the automatic excerpt below it.

    Is this possible to do?

    Thanks,

    #28064

    Cici
    Keymaster

    I’m not sure of the answer but a more general search may help. Store pages use the default WP system, so you may be able to do this with another plugin the handles custom page types.

    Can you post a URL where we can see what you are trying to do?

    #28124

    Lïncheran
    Participant

    Hi,

    i cannot post URL’s because the site is hidden to public view (under development). Let me explain my problem: i created an archive page listing all my Store Pages generated by the plugin and i need to display part of “the_content()” in there. I have the titles and the “Read more” link, but when i try to add the page content using “the_content();” call i just retrieve content from the first listed page in each of them.

    How can i display the content of each page instead of duplicating the first one in all?

    PD: below the code of my archive loop page.

    Thanks,

     

    <?php if ( ! have_posts() ) : ?>
    <div id=”post-0″ class=”post not-found post-listing”>
    <h2 class=”post-title”><?php _e( ‘Not Found’, ‘tie’ ); ?></h2>
    <div class=”entry”>
    <p><?php _e( ‘Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.’, ‘template’ ); ?></p>
    <?php get_search_form(); ?>
    </div>
    </div>
    <?php else : ?>

    <div class=”post-listing”>
    <?php while ( have_posts() ) : the_post(); ?>

    <article <?php template_post_class(‘item-list’); ?>>
    <h2 class=”post-box-title”>” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘tie’ ), the_title_attribute( ‘echo=0’ ) ); ?>” rel=”bookmark”><?php the_title(); ?></h2>
    <div class=”entry”>
                <?php the_content(”,FALSE,”); ?>
    “><?php _e( ‘Read More »’, ‘template’ ); ?>
    </div>
    <div class=”clear”></div>
    </article>

    <?php endwhile;?>
    </div>

    <?php endif; ?>

    #28754

    James
    Participant

    This is the same problem i have. Lincheran, did you find a solution?

    #28760

    Lïncheran
    Participant

    Hi James,

    no solution yet. I spent several hours looking at Google: blogs, WP forums, etc. I think i looked at all the existent posts around the net about, WP loops, WP archive loops and related stuff. Its seems to be a problem with the loop calls but i can’t find the point. Believe me i tried many combinations and hacks with no luck at all. I decided to set aside the issue because i spent too much time on it. I will probably look for a professional WP expert to solve it. Please reply if you find a way to do that, i feel frustrated.

    Thanks,

    #28761

    James
    Participant

    Thanks for the reply! I created another topic on this subject before i found this thread .

    I’ve tried all the usual steps to troubleshoot. The way i’m getting around this for now, while i wait for a solution from the authors, is to create custom fields for all the information i want to show in the regular archives (eg i have a custom field for address, phone etc.). Then for my search templates and archive templates – ie the places where the shortcodes are just repeating the first post in the loop, i am using my custom fields instead. In the map results and map bubble i am using the shortcodes as intended and everything is working as it should. Then everything links back to the single store pages, so it is pretty seamless from a user point of view.

    The problem with that of course is i have to put the information in twice – once for the map, and then i open the store page and fill everything in a second time… so it’s super clunky.

    #28804

    Lïncheran
    Participant

    Hi James,

    i tried custom fields either but as you say is double work i want to avoid if possible, because i have more than 100 stores and that’s not a consistent solution. We need to find a simple automated solution because i believe is not a big deal. I still think its a looping problem.

    Is there a WP expert that can give us a hand?

    Thanks,

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

You must be logged in to reply to this topic.