Remove "Archive" from Archive page

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #23376
    oligo11
    Participant

    Hi there,

    after a search in the forum, I found the following code I copied/pasted in my child theme function.php :

    function travel_log_child_remove_cat_titles($title) {
    
        if ( is_archive() ) {
            $title = single_cat_title( '', false );
        } elseif ( is_tag() ) {
            $title = single_tag_title( '', false );
        } elseif ( is_author() ) {
            $title = '<span class="vcard">' . get_the_author() . '</span>' ;
        }
        return $title;
    }
    add_filter( 'get_the_archive_title', 'travel_log_child_remove_cat_titles' );

    The problem to me is that it suppresses the whole category title, leaving a page without title.
    So, instead of removing: “archives: itinerary” I would like it to display only “itinerary” and remove only the word “archives:”

    Is that possible?
    Thank you
    Olivier

    #23399
    wensolutions
    Keymaster

    Hello,

    Can you please provide us with site URL so that we can help you?

    Regards.

    #23409
    oligo11
    Participant

    Hi,
    thanks for your reply.
    Here is the page: http://roadzine.idealand.fr/sejours/
    In the permalinks settings, I replaced “itinerary” by “sejours” so on the front end, the page displays: “archives: sejours”, which is normal.

    I would like to know if it is possible to suppress only the word “archives: ” and display only the slug “sejour”.

    If not, is there a way to create a page where I would display all my itineraries classified by date?

    Thank you and regards
    Olivier

    ps: I’m on WP Travel Pro

    #23424
    wensolutions
    Keymaster

    Hello,

    Please add following given code in functions.php file of your child theme to remove the word ‘Archives:’.

    add_filter('get_the_archive_title', function ($title) {
        return preg_replace('/^\w+: /', '', $title);
    });

    Hope this helps.

    If you have any queries further, let us know.

    Thank you.

    #23425
    oligo11
    Participant

    Hi, thank you but it’s not working.

    If it’s not possible, is there a way to create a page where I would display all my itineraries classified by date? Like an archive page?
    Thanks

    #23426
    wensolutions
    Keymaster

    Hello,

    Actually, the code we have provided is working fine in our side as you can see in screen record below:

    https://www.loom.com/share/fac9f1ef8530470992ff425aadac1e0f

    So, can you please make sure that you have added the code in functions.php file of your child theme properly?

    Also, make sure that the child theme has been activated.

    Further, if it doesn’t work then please provide us with admin login detail in below given email so that we can help you.

    email: support@wptravel.io

    Thank you.

    #23464
    oligo11
    Participant

    Thanks for your reply.
    Ok, I’ll check this out (I’m off for a week). It should work and I’ll let you know.
    Thanks for your help
    Regards

    #23493
    wensolutions
    Keymaster

    Hello,

    Of course, during verification of issue please let us know if issue will be resolved or not.

    Thank you.

    #23843
    oligo11
    Participant

    Hi,
    I am back as the site is now ok again.

    Sorry but it’s still not working and I followed your instructions.
    Can you please check this for me? I sent my credentials earlier today…

    Also, can you tell me which shortcode to use if instead of making an archive page, I want to list only a specific category of tours on a dedicated page (like Group’s Tour or Individual Tours).
    Thank you
    Oli

    #23850
    wensolutions
    Keymaster

    Hello,

    Actually, we are unable to edit the file in backend section as you can see in screenrecord below:

    https://www.loom.com/share/85fe70a028ca4c7cb234ee5ad9b0c031

    Regarding using shortcode, you can use shortcode to display the trips according to trips_types, trips_by_location, featured_trips etc.

    For detail assistance regarding shortcode available for trips, please refer link of our official documentation which is given below:

    https://wptravel.io/documentations/user-documentation/#doc-shortcode-50

    Regards.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘WP Travel Pro’ is closed to new topics and replies.