Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #35900
    Javier Trevizo
    Guest

    Hello. I am trying to place shortcode in the header. I’ve gone to the westview header.php file and pasted the shortcode after this line <div class=’col-md-6 header-7′><?php do_action( ‘boldgrid-theme-location’, ‘header’, ‘7’ ); ?></div>

    My issue comes that the shortcode is below the header slightly. It is not in line with the menu. If i place it before the line then it is also not aligned. I’m unsure as how to place it in line with the other menu items in the header.

    #35916
    Jesse Owens
    Keymaster

    Hi Javier-

    Thanks for reaching out, and thanks for using the Westview WordPress theme.

    I took a look at your site, and I’m assuming that you’re trying to move your GTranslate language switcher into the menu. If my assumption is right, there’s a much easier way to accomplish this, but please correct me if I’m wrong about my assumption.

    The GTranslate plugin makes this very easy by providing a setting to put the switcher into a menu. Navigate to Settings > GTranslate and look for the Show in menu setting:

    If you’re trying to accomplish this with a different shortcode, you might consider the free Shortcode in Menus Plugin.

    If you really do want to put it in the template, you’ll need to modify the template a little bit. I see that you’re already using a Child Theme, which is great. Copy the head.php file into your Child Theme, and modify it to something similar to this:

    <div class='col-md-3'><?php do_shortcode('gtranslate'); ?></div>
    <div class=’col-md-3 header-7′><?php do_action( ‘boldgrid-theme-location’, ‘header’, ‘7’ ); ?></div>
    #35958
    Javier Trevizo
    Guest

    Thank you for your timely response.

    You are correct there is a drop down menu in the Gtranslate settings, but the only option available is -None-.

    I will try the shortcode plugin. Thank you for your advice.

    #35970
    Javier Trevizo
    Guest

    Thank you for your timely response.

    You are correct there is a drop down menu in the Gtranslate settings, but the only option available is -None-.

    I attempted to use the short code in menu plugin, but I was unable to use the shortcode option when adding to a menu. It would not show up even though the appropriate shortcode option was checked. The shortcode menu item would not appear on the list when adding items. When I attempted to edit menus in admin mode it said “Your theme does not support navigation menus or widgets.”

    I tried adding the code to the head.php, but the head.php only has the following code.

    <head>
    	<meta charset="utf-8">
    	<meta http-equiv="x-ua-compatible" content="ie=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
    	<?php wp_head(); ?>
    </head>

    I had originally added the shortcode to header.php, but when I add `<div class=’col-md-3′><?php do_shortcode(‘gtranslate’); ?></div>
    <div class=’col-md-3 header-7′><?php do_action( ‘boldgrid-theme-location’, ‘header’, ‘7’ ); ?></div>` to header.php the language select tool does not show up.

    I also changed the class to col-md-6 to align with what is in my current template, but that results in the same thing where the language select tool is missing entirely.

    #36012
    Jesse Owens
    Keymaster

    Hi Javier-

    Thanks for the reply, sorry that you’re still having trouble! I did make a couple of mistakes-

    I tried adding the code to the head.php […] I had originally added the shortcode to header.php [… but] the language select tool does not show up.

    You’re right, I meant to say header.php, and I also made a mistake in the code. It should be do_shortcode('[gtranslate]'); (I forgot the brackets in the shortcode).

    “Your theme does not support navigation menus or widgets.”

    This sounds like there may be a technical issue going on with your Child Theme configuration. Double-check the sample files in this tutorial to make sure that the parent Westview theme is being enqueued correctly. If you’re still seeing that message, let us know what you have in your style.css and your functions.php files.

    #36028
    Javier Trevizo
    Guest

    I added the code and it did put the language select tool in line with the menu. I found the issue for the menu option in Gtranslate. The Westview theme had not been updated. Once I updated the theme Gtranslate showed options to set the language select tool into the primary menu and it worked well.

    Thank you for your help.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Placing Short Code in the Header Even with Menu’ is closed to new replies.