WordPress.org

Ready to get started?Download WordPress

Forums

SimpleModal Contact Form (SMCF)
How does the smcf class work? (6 posts)

  1. blitz999
    Member
    Posted 3 years ago #

    I activated SMCF and it worked first time beautifully. I have now set up the menus using the Appearance/Menus feature in WP3+.

    The modal contact window no longer opens, but goes to the contact page.

    I saw Eric's comment on a different post and tried this to test (within a page) contact

    This works great, so I know it is working, but… how do I get the actual main menu Contact link to activate the modal window again?

    I tried to make a custom link, but there appears no simple way to add the class.

    Thanks in advance.

    http://wordpress.org/extend/plugins/simplemodal-contact-form-smcf/

  2. Eric Martin
    Member
    Plugin Author

    Posted 3 years ago #

    Do you happen to know the WP function that is used to generate the menu?

    I need to research and see about adding a filter into the function to add the class.

  3. blitz999
    Member
    Posted 3 years ago #

    Hi Eric, thanks for the swift response.

    I think you mean wp_nav_menu…

    I've copied in the code from the header.php (I'm not using a sub-navigation).

    `<?php
    if(function_exists('wp_nav_menu')) {
    wp_nav_menu( array( 'theme_location' => 'main', 'menu_class' => 'sf-menu','sort_column' => 'menu_order', 'container_class' => 'main-navigation', 'fallback_cb' => 'display_home' ) );
    wp_nav_menu( array( 'theme_location' => 'sub', 'sort_column' => 'menu_order', 'container_class' => 'sub-navigation', 'fallback_cb' => 'display_none' ) );
    } else {
    echo '<div class="main-navigation"><ul class="sf-menu"><li><a href="'.get_bloginfo('url').'">Home</a></li>';
    wp_list_categories('title_li=');
    echo '</ul></div>';
    }
    ?>`

    This is how it outputs (just showing the contact page li):

    <div class="main-navigation"><ul id="menu-main-menu" class="sf-menu"><li id="menu-item-16" class="menu-item menu-item-type-taxonomy menu-item-16"><a href="(myurl)/contact/">Contact</a></li></ul></div>

    Any ideas?

  4. Eric Martin
    Member
    Plugin Author

    Posted 3 years ago #

    Here's a quick fix. Open smcf.php and below
    add_filter('wp_list_pages', array($smcf, "page_menu_list"));

    Add:
    add_filter('wp_nav_menu_items', array($smcf, "page_menu_list"));

    Then, on your Appearance > Menus page, make sure the Contact menu has a title attribute that matches the Contact Link Title: value on your SMCF settings page.

    That should do the trick. If not, let me know...

  5. sergeylive
    Member
    Posted 3 years ago #

    Good day all! I have a problem.
    I use wp_nav_menu( array( 'container' => 'table',
    'container_class'>'table_menu',
    'menu_class' => 'menu', 'menu_id' => 'topnav', 'depth' => 0, 'theme_location' => 'mainmenu',
    'walker' => new description_walker()));

    And i can't insert Contact to it menu.

    my walker it:
    add_filter('wp_page_menu', array($smcf, "page_menu_list"));
    add_filter('wp_list_pages', array($smcf, "page_menu_list"));

    and adding add_filter('wp_nav_menu_items', array($smcf, "page_menu_list")); doesn't work. Please help.

  6. Eric Martin
    Member
    Plugin Author

    Posted 3 years ago #

    In order for it to work, your link needs to include the smcf-link class, or the title attribute needs to be "Contact" (or whatever value you have specified in your SMCF options).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic