Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1126491
    ericshew
    Participant

    Hi there,

    I would like to create a new widget category for my child theme and then add it to the topbar. Can you please provide me with a walk through for this? Thank you.

    #1126791
    Friech
    Moderator

    Hi There,

    Thanks for writing in! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. What do you mean new widget category? If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.

    Cheers!

    #1127245
    ericshew
    Participant

    The current widgets in X are things like header 1, header 2, header 3, etc.

    I would like a widget that said “top bar” and allowed people to add new content in the same way as a normal widget.

    Barring that, I would like to have a shortcode or some other way of adding content to the navigation.

    Thank you.

    #1127388
    Rahul
    Moderator

    Hey There,

    Thanks for writing in!

    You can go thorough the following link for more information regarding your query.

    https://community.theme.co/forums/topic/widget-in-topbar-on-renew-theme-7//a>

    Let us know how it goes!

    #1127465
    ericshew
    Participant

    That link doesn’t work. Can you send me to link that works? Also: I’m using the Integrity theme. Can you confirm this process will work for that theme?

    #1127567
    Rupok
    Member

    Hi there,

    Sorry for the inconvenience. It should be https://community.theme.co/forums/topic/widget-in-topbar-on-renew-theme-7/

    Let us know if you need any other assistance.

    Cheers!

    #1128255
    ericshew
    Participant

    I tried this and didn’t work. I’m not sure if you answered my question: can you confirm that this will work with integrity? Thank you.

    #1128403
    Rupok
    Member

    Hi there,

    Thanks for writing back. If you want to create a “Widget Area” then it will need some more complex code with functions.php as you need to create a new widget area. It would be out of our support scope as it’s more like a plugin functionality.

    But the above thread is a working example to print a shrotcode within the Topbar – https://community.theme.co/forums/topic/widget-in-topbar-on-renew-theme-7/#post-274102

    Here goes the actual shortcode printing on the code :

    <div class="gwt-wrap"><?php echo do_shortcode('[prisna-google-website-translator]'); ?></div>

    So you can place your own shortcode and div class to style it your own way.

    Hope this makes sense.

    #1129323
    ericshew
    Participant

    This is the third time I’ve asked this question. Can you confirm that this will work with integrity? Thank you.

    #1129679
    Friech
    Moderator

    Hi There,

    Sorry for the confusion. Yes, that should work on any stacks as the topbar is a global element. To add a topbar widget please follow this step instead.

    First navigate to Appearance > Sidebars, create a new sidebar, do not enable this sidebar on any page, and take note of the sidebar ID.

    Then navigate to Appearance > Widgets, you should see the newly created sidebar there for you to place some widget.

    To call your sidebar on the topbar. 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.

    Then on your child theme navigate to this directory: \x-child\framework\views\global\ from there create a new file named _topbar.php and paste the code below in it.

    <?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 if ( is_active_sidebar( 'YOUR CREATED SIDEBAR ID HERE' ) ) : ?>
    			<?php dynamic_sidebar( 'YOUR CREATED SIDEBAR ID HERE' ); ?>
    		<?php endif; ?>
          <?php endif; ?>
          <?php x_social_global(); ?>
        </div>
      </div>
    
    <?php endif; ?>

    Replace the YOUR CREATED SIDEBAR ID HERE with your actual sidebar ID, then save.

    Provide us your site URL for applying CSS.

    Hope it helps, Cheers!

  • <script> jQuery(function($){ $("#no-reply-1126491 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>