Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #185588

    William Y
    Participant

    Hello. Can shortcode work in X top bar now? I recall at first it could not, but maybe with the new updates you have made those possible… 🙂 Just wanted to add a shortcode in the top bar…

    Thanks!

    #186033

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Then you can copy the file “_topbar.php” file into your Child Theme and Edit the file using a Text Editor and add the shortcode as follows below the line <p class="p-info">.

    <?php echo do_shortcode('[SHORTCODE-HERE]'); ?>

    Hope that helps.

    #188342

    William Y
    Participant

    Alright. I will try that… Thanks!!!! 🙂

    #188571

    William Y
    Participant

    Hello, what should be the path of the file in the child theme? >>>>>>>

    I tried the following and it didn’t work… CHILD THEME/framework/views/global/_topbar.php

    ========================= CONTENT ===============================

    <?php

    // =============================================================================
    // VIEWS/GLOBAL/_TOPBAR.PHP
    // —————————————————————————–
    // Includes topbar output.
    // =============================================================================

    ?>

    <?php if ( x_get_option( ‘x_topbar_display’, ” ) == ‘1’ ) : ?>

    <div class=”x-topbar”>
    <div class=”x-topbar-inner x-container-fluid max width”>
    <?php if ( x_get_option( ‘x_topbar_content’ ) != ” ) : ?>
    <p class=”p-info”><?php echo
    <?php echo do_shortcode(‘[SHORTCODE-HERE]’); ?>
    x_get_option( ‘x_topbar_content’ ); ?></p>
    <?php endif; ?>
    <?php x_social_global(); ?>
    </div>
    </div>

    <?php endif; ?>

    Thanks!

    #188750

    Paul R
    Moderator

    Hi William,

    Path should be wp-content/themes/x-child-integrity-light/framework/views/global/_topbar.php

    If that doesn’t help, would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #190602

    William Y
    Participant

    Hello,

    I’m just thinking maybe the older way you suggested is conflicting with the new way you’re suggesting…

    Sometime ago you suggested adding the code below in functions.php

    ======================================================

    add_filter(‘theme_mod_x_topbar_content’,’x_topbar_do_shortcode’);

    function x_topbar_do_shortcode($content) {
    return do_shortcode( $content );
    }

    #191097

    Christopher
    Moderator

    Hi there,

    Create _topbar.php file under YOUR CHILD THEME -> framework -> views -> global and add this code in there:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_TOPBAR.PHP
    // -----------------------------------------------------------------------------
    // Includes topbar output.
    // =============================================================================
    
    ?>
    
    <?php if ( x_get_option( 'x_topbar_display', '' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php echo do_shortcode('[SHORTCODE-HERE]'); ?>
          <?php endif; ?>
          <?php x_social_global(); ?>
        </div>
      </div>
    
    <?php endif; ?>

    Now instead of [SHORTCODE-HERE] put your shortcode in code above.

    Thank you.

    #337475

    andisites
    Participant

    Hi, I’ve just tried this on my own site for the Subscribe2 plugin (the shortcode is [subscribe2]), and it’s not working. The URL is http://http://109.199.101.20/~efcnetwo/

    Here’s the code I put into the copy of _topbar.php that I put into /public_html/wp-content/themes/x-child/framework/views/global:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_TOPBAR.PHP
    // -----------------------------------------------------------------------------
    // Includes topbar output.
    // =============================================================================
    
    ?>
    
    <?php if ( x_get_option( 'x_topbar_display', '' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php echo do_shortcode('[subscribe2]'); ?>
          <?php endif; ?>
          <?php x_social_global(); ?>
        </div>
      </div>
    
    <?php endif; ?>
    #337485

    andisites
    Participant
    This reply has been marked as private.
    #337640

    Rue Nel
    Moderator

    Hello There,

    Upon checking your site, the form is being displayed by given code already. The code seems to be enclosed with an html comment and that is why it is not showing in the front end. You can check it by viewing the source code of the page. http://prntscr.com/7vw2v3

    Please check your subscribe 2 shortcode being displayed. It may sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts as our support policy in the sidebar states due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

    Thank you for your understanding.

    #644935

    fish
    Participant

    Hi Staff I have a question regarding this topic.

    I’m trying to add this shortcode [periscope_on_air username=”jwiproperties” size=”small”] to the topbar so my client can display the Twitter Periscope on air button.

    I’ve search all the threads regarding this topic but have yet to find a solution.

    I’ve already tried adding the following to the child themes _topbar.php file.

    .

    <?php if ( x_get_option( 'x_topbar_display', '' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php echo do_shortcode('[periscope_on_air username=”jwiproperties” size=”large”]'); ?>
          <?php endif; ?>
          <?php x_social_global(); ?>
        </div>
      </div>
    
    <?php endif; ?>

    Any suggestions would be highly valued.

    Thanks for your time in advance,
    Fish

    #645299

    Jade
    Moderator

    Hi Fish,

    Can you try to use this code instead:

    <?php if ( x_get_option( 'x_topbar_display', '' ) == '1' ) : ?>
    
      <div class="x-topbar">
        <div class="x-topbar-inner x-container max width">
          <?php if ( x_get_option( 'x_topbar_content' ) != '' ) : ?>
          <p class="p-info"><?php echo x_get_option( 'x_topbar_content' ); ?></p>
          <?php echo do_shortcode('[periscope_on_air username="jwiproperties" size="large"]'); ?>
          <?php endif; ?>
          <?php x_social_global(); ?>
        </div>
      </div>
    
    <?php endif; ?>

    The only different is the character used in the shortcode " instead of ”.

    I am not certain if it’s because of an incompatibility in plugin but in case the first suggestion wouldn’t work kindly provide us with your FTP details so we can check it. Thank you.

    #645407

    fish
    Participant
    This reply has been marked as private.
    #645676

    Rue Nel
    Moderator

    Hello Fish,

    We have tried to login to your ftp. The directory is empty. Would you also provide us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    To do this, you can make a post with the following info:
    – Link to your site

    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thank you.

    #646215

    fish
    Participant
    This reply has been marked as private.