Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #190440

    Hi,

    I have a shortcode from a 3rd party plugin (form generator) that creates a pop-up contact form. I have been trying to put links to 2 popup forms into the top custom menu (enfold secondary menu) or in the header phone number/small info text area (under theme options>>header). Unfortunately, menu URLs won’t except shortcodes (I read I could use placeholders and add the shortcode to functions.php, but I’m slightly lost with it) and neither will the phone number/small info text box.

    Is there an easy way for me to add this in? I also tried adding the code directly into header.php, but I can’t get the styling and positioning right. I am a PHP novice!

    Shortcodes:
    [contactformgen_popup id=5]Pet Owners Login[/contactformgen_popup]
    [contactformgen_popup id=4]Vets Login[/contactformgen_popup]

    PHP for one of the popup forms:
    <?php
    if(function_exists(‘contactformgen_popup’)){
    contactformgen_popup(5, ‘Pet Owners Login’);
    }
    ?>

    The PHP I tried to add to the header (using the phone info class as I want it to appear there):
    $cfclogin1 = contactformgen_popup(4, ‘Vets Login’);
    $cfclogin2 = contactformgen_popup(5, ‘Pet Owners Login’);
    echo “<div class=’phone-info {$phone_class}’><span>{$cfclogin1} | {$cfclogin2}</span></div>”;

    Any help would be greatly appreciated!

    Thanks,

    Matt

    #190795

    Hey Matt!

    Have you tried with do_shortcode?

    Regards,
    Josue

    #325285

    Hi Josue,

    I read with interest your recommendation of do_shortcode for the purpose of adding, in my case, short code for google translate into the secondary menu area of enfold (above header area).

    Exactly how and where would I insert “[google-translator]” using the do_shortcode command?

    Thanks!

    Pelyon

    #325481

    Hey!

    The code should look like this:

    <?php echo do_shortcode('[google-translator]'); ?>
    

    Regards,
    Ismael

    #325772

    Hi Ismael,
    Thank you. Now where does this code go exactly? Which php doc, or where in the theme backend?
    Thanks again.
    -Pelyon

    #326021

    Sorry. To be more specific, If I want to place some short code so that google translate ( or any other widget shortcode for that matter) can appear in the top secondary menu area, where do you suggest placing the “do_shortcode” code? functhions.php?

    Thank you,

    -Pelyon

    #326960

    Hey!

    Thank you for the info.

    Add this on functions.php file:

    function add_custom_script_translator(){
     echo "<div class='g-trans'>".do_shortcode('[google-translator]')."</div>";
    }
    add_action('avia_meta_header', 'add_custom_script_translator', 10);

    Use .g-trans selector to adjust the position of the container.

    Best regards,
    Ismael

    #327574

    Hi,

    Thank you. This code appears to work only when I have a menu item included in the secondary menu. Without a menu item (which is what I want) the shortcode does not work. Any suggestions? Thank you!

    http://billrusselldesign.com/sr_volunteers/

    #327936

    Hi!

    Please set a dummy secondary menu then hide it using this on Quick CSS or custom.css:

    #header_meta nav.sub_menu {
    visibility: hidden;
    }

    Cheers!
    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Shortcodes in custom menu’ is closed to new replies.