Invoices showing up in Sitemap

This topic contains 3 replies, has 3 voices, and was last updated by  Atilla Boz 7 years, 2 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #472

    Atilla Boz
    Buyer
    Post count: 280

    Hello guys,

    I have a bigger problem with the invoices links. They show up in my sitemap, where I use the following code to show the content in 3 rows, the Invoices show up in the first row with the directory entries in first place. The row starts with: <div class=”sitemap-spalte1″>

    
    
    <div class="sitemap">   
        <a name="sitemap-spalte1"></a>
        <div class="sitemap-spalte1"> 
            <h2 id="custom_posts" class="hop-schrift">Dienstleister / Events / Trauorte</h2> 
            <?php 
                foreach( 
                    get_post_types( array('public' => true) ) as $post_type ) { 
                        if ( in_array( $post_type, array('post','page','attachment') ) ) continue; 
                        $pt = get_post_type_object( $post_type ); 
                        echo '<h2>'.$pt->labels->name.'</h2>'; 
                        echo '<ul>'; 
                            query_posts('post_type='.$post_type.'&posts_per_page=-1'); 
                            while( have_posts() ) { 
                                the_post(); 
                                echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
                                } 
                        echo '</ul>'; }
    
            ?>
        </div>
        <a name="sitemap-spalte2"></a>
        <div class="sitemap-spalte2"> 
            <h2 id="posts" class="hop-schrift">Beiträge</h2> 
                <?php   
                        $cats = get_categories('exclude='); 
                         foreach ($cats as $cat) { echo "<h3>".$cat->cat_name."</h3>"; 
                         echo "<ul>"; 
                         query_posts('posts_per_page=-1&cat='.$cat->cat_ID);
                         while(have_posts()) { the_post();
                         $category = get_the_category(); 
                         if ($category[0]->cat_ID == $cat->cat_ID) { echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>'; } } echo "</ul>";} 
                ?> 
        </div>
        <a name="sitemap-spalte3"></a>
        <div class="sitemap-spalte3"> 
            <h2 id="pages" class="hop-schrift">Seiten</h2> 
                <?php // Add pages you'd like to exclude in the exclude here wp_list_pages( array( 'exclude' => '', 'title_li' => '', ) ); 
                      wp_list_pages( array( 'exclude' => false, ) );
                ?> 
        </div>
    </div>

    You have any idea how I should change my script, so the invoices don`t show up in the sitemap.

    Thank you very much,
    Atilla

    #473

    Paolo
    Site Admin
    Post count: 31206

    Hi Attila,

    this is a bit beyond support, however developers will reply after week end if possible.

    Thanks

    #475

    Kiran
    Moderator
    Post count: 7069

    Hi Attila,

    You can skip invoices from sitemap by using any one way of following.
    1) Replace

    get_post_types( array('public' => true) ) as $post_type ) {

    with

    get_post_types( array('public' => true, 'exclude_from_search' => false) ) as $post_type ) {

    OR

    2) Replace

    if ( in_array( $post_type, array('post','page','attachment') ) ) continue;

    with

    if ( in_array( $post_type, array('post','page','attachment','wpi_invoice','wpi_quote') ) ) continue;

    Thanks,
    Kiran

    #675

    Atilla Boz
    Buyer
    Post count: 280

    Hello Kiran!

    I just had the plaesure to test your code and it works flawless. I took the first version and the links are gone, like they should.

    Thank you very much. This is resolved 🙂

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

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

Open Support Ticket