Support Forum » User Profile

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: How to remove the slug from the permalink of a CPT #42188
    KnütKnüt
    Participant

    Hello Francesco!

    You need to add both of these PHP snippets to your site (via functions.php or using a code snippet plugin such as WPCodeBox): https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/

    Then, change where it says "race" for the slug of your CPT.

    After that, go to Settings > Permalinks and re-save being /%postname%/ your structure.

    And it should work! 🙂 I have tested just now in a website I am working on.

    in reply to: How to remove the slug from the permalink of a CPT #41197
    KnütKnüt
    Participant

    Just for future reference, what have worked best for me is following these steps:
    https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/

    in reply to: Show custom Fields on a list of Taxonomy terms #32355
    KnütKnüt
    Participant

    Hi!

    I rewrite all the code using echo, not printf, and now it works fine!

    Thanks for your help!

    in reply to: Show custom Fields on a list of Taxonomy terms #32354
    KnütKnüt
    Participant

    Hi,

    That's great!

    Do you know how I can print $mes_butlleti and $any_butlleti into the HTML below?

    I would like to have those term data where it says <p>HERE I NEED TO PRINT THE mes_butlleti AND any_butlleti DATA<p>

    <?php
    $terms = get_terms( array(
    'taxonomy' => 'butlleti', // set your taxonomy here
    'orderby' => 'none', // default: 'orderby' => 'name',
    'order' => 'ASC',
    'hide_empty' => true, // default: true
    'number' => 1,
    ));
    if ( empty( $terms ) || is_wp_error( $terms ) ) {
    return;
    }
    echo '<div class="butlletins__list-container">';
    foreach( $terms as $term ) {
        $mes_butlleti= rwmb_meta( 'mes_butlleti', ['object_type' => 'term'], $term->term_id );
        $any_butlleti= rwmb_meta( 'any_butlleti', ['object_type' => 'term'], $term->term_id );
        echo $mes_butlleti;
        echo $any_butlleti;
    printf(
    '<a href="%s">
        <div class="butlletins__list">
            <p class="p-big">BUTLLETÍ N. <strong>%s</strong></p>
            <div class="butlletins__list-line"></div>
            <p>HERE I NEED TO PRINT THE mes_butlleti AND any_butlleti DATA<p>
            <span class="butlletins__list-new">NOU</span>
        </div>
    </a>',
    esc_url( get_term_link( $term ) ),
    esc_attr( $term->name ),
    $term->count
    );
    }
    echo '</div>';
    
    ?>

    Thanks!!!

    in reply to: Show custom Fields on a list of Taxonomy terms #32333
    KnütKnüt
    Participant

    Hi Long Nguyen,

    Thanks for your help!

    I've been reading your documentation, but I can't figure it out how to make it work with the code I already have to show both the Terms and a Custom Field of that term.

    Could you please help me figure it out?

    Thank you!

    in reply to: How to remove the slug from the permalink of a CPT #31979
    KnütKnüt
    Participant

    Thank you! 🙂

    in reply to: Add a Featured Image to Categories in Posts #29481
    KnütKnüt
    Participant

    Hi,

    Ok, that's great! The documentation was quite confusing at first.

    Thank you Long Nguyen!

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