0

I'm running a multi-vendor WP site where users can create a business profile. The profile is a custom post type (wyz-business).

I'm looking to get the URL of logged in user's profile (custom post type).

Looking at the developer's code, they seem to get the URL of logged in user's business with

<?php echo get_the_permalink( $curr_id );?>

What I'm trying to achieve is to create an embed link that users can put on their websites. Below is my code from functions.php and then I embed the shortcode on user's dashboard - BUT it's returning the URL of the dashboard and not user's profile:

add_shortcode('embed-button', 'btn_embed');
function btn_embed(){
?>
&lt;a href="<?php echo get_the_permalink( $curr_id );?>"&gt;Visit My Profile&lt;/a&gt;
<?php
};

What am I doing wrong?

This is the full code and I'm looking at class "title".

<div class="publish-offers col-xs-12">

        <?php do_action( 'wy_user_account_before_published_businesses' );?>

        <div class="row">

        <?php foreach( $user_businesses['published'] as $curr_id ) :

            $curr_post = get_post( $curr_id );?>
        <div class="sin-pub-offer">
            <div class="logo"><?php echo WyzHelpers::get_post_thumbnail( $curr_id, 'business', 'thumbnail' );?></div>
            <div class="title"><h4><a href="<?php echo get_the_permalink( $curr_id );?>"><?php echo get_the_title( $curr_id ); ?></a></h4></div>
            <div class="buttons">
                <?php $business_tbl_btns =  array(
                    'manage' => array(
                        'link' => WyzHelpers::add_clear_query_arg( array( WyzQueryVars::ManageBusiness => $curr_id ) ),
                        'label' => esc_html__( 'manage', 'wyzi-business-finder' )
                    )
                );
                if ( 'off' != get_option( 'wyz_users_can_booking' ) && WyzHelpers::wyz_sub_can_bus_owner_do( get_current_user_id() , 'wyzi_sub_business_can_create_bookings' ) ){
                    $business_tbl_btns['calendar'] = array(
                        'link' => WyzHelpers::add_clear_query_arg( array( WyzQueryVars::BusinessCalendar => $curr_id ) ),
                        'label' => esc_html__( 'calendar', 'wyzi-business-finder' )
                    );
                }
                $business_tbl_btns = apply_filters( 'wyz_published_business_table_buttons', $business_tbl_btns, $curr_id );
                foreach ($business_tbl_btns as $key => $value) {
                    echo '<a href="' . $value['link'] . '"' . ( isset( $value['extra'] ) ? ( ' ' . $value['extra'] ) : '' ) . 'class="' . ( isset( $value['class'] ) ? $value['class'] : $btn_class ) . '">' . $value['label'] . '</a>';
                }?>
            </div>
        </div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.