WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Conditional hyperlink for store url

[Resolved] Conditional hyperlink for store url

  • 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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit
    Participant

    @tijmensmit

    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.

    JFrankParnell
    Member

    @jfrankparnell

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Conditional hyperlink for store url’ is closed to new replies.