• Resolved cdexswzaq

    (@cdexswzaq)


    Hi,

    I want to swop around the “title” and “designation” in my shortcode.

    So for example, the 4th picture would read “Hazel Bugler | Yoga”

    See the page linked to. This is with theme “square 5”. Can you help?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author WP Speedo

    (@wpspeedo)

    Hey @cdexswzaq,

    I hope you are fine today!

    To modify the output, you have to use a custom script. you can use the script in multiple ways, I prefer the mu-plugins method. Please follow the below steps:

    1: Create a mu-plugins folder inside the wp-content folder, if already not exists.

    2: Create a PHP file with a name you like inside the mu-plugins folder. For example wps-team–modifications.php

    3: Edit the PHP file you have just created, paste the below code, and save it.

    <?php
    
    /**
     * This function will modify the WPS Team plugin's member name.
     * It will add the designation if found at the end of the name with the '|' separator.
    */
    function wpspeedo_team__title_modify( $title, $post_id ) {
        if ( is_admin() ) return $title;
        if ( is_singular('wps-team-members') ) return $title;
        if ( get_post_type($post_id) !== 'wps-team-members' ) return $title;
    
        $designation = get_post_meta( $post_id, '_designation', true );
        if ( empty($designation) ) return $title;
    
        return $title . ' | ' . $designation;
    }
    add_filter( 'the_title', 'wpspeedo_team__title_modify', 10, 2 );

    Let me know how it goes. If you have any issue let me ping here. have a good day!

    Please do not forget to give us a rating.

Viewing 1 replies (of 1 total)
  • The topic ‘Modify shortcode’ is closed to new replies.