WordPress.org

Ready to get started?Download WordPress

Forums

WP Store Locator
[resolved] Conditional hyperlink for store url (3 posts)

  1. jambo135
    Member
    Posted 2 months ago #

    Hi I notice there is an option to use the store name as a link to their URL if one is provided. Please can you tell me if there is a way to make this conditional depending on if the user is logged in e.g. the code below. If so please can you help me find where to add the code.

    Kind Regards

    James

    <a href="
    <?php
    if ( is_user_logged_in() ) {
    $link = '/mylink/';
    echo $link;
    } else {
    $link = '/myotherlink/';
    echo $link;
    }
    ?>
    ">
    **STORE NAME ?**

    https://wordpress.org/plugins/wp-store-locator/

  2. Tijmen Smit
    Member
    Plugin Author

    Posted 1 month ago #

    No not with php, whether the store is turned into an url or not is checked in the js file in the storeHtml function.

    What you could do is check if the body class 'logged-in' is set with js. If so, you could change the structure of the output.

  3. JFrankParnell
    Member
    Posted 1 month ago #

    axly, in wpsl_store_search(), instead of SELECT *, you could change it to SELECT [all fields except url] if ( is_user_logged_in() )...

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.