Giter Club home page Giter Club logo

Comments (5)

macdonaldr93 avatar macdonaldr93 commented on July 16, 2024

@jsbls you could override the end_lvl method and append your widget before the closing tag for the menu. Let me know if that works.

See: https://codex.wordpress.org/Class_Reference/Walker#Abstract_Methods

from yamm-nav-walker.

jsbls avatar jsbls commented on July 16, 2024

Ok, let me give it a try right now. Thanks!

EDIT:

So the following happens. If I add plain HTML, it renders correctly, but PHP gets placed before the <ul class="yamm"> wrapper. For example:

public function end_lvl( &$output, $depth = 0, $args = array() )
{
    $output .= ($depth == 0) ?
        "\n<div>Hello, world</div>\n" .
        "\n</div>\n" . // .row
        "\n</div>\n" . // yamm-content
        "\n</ul>\n" // .dropdown-menu
        : "\n</ul>\n"; // else .subcat-ul
}

renders (I'm ignoring the else statement)

<ul class='dropdown-menu'>
    <div class='yamm-content'>
        <div class='row'>
            <div>Hello, world</div>
        </div>
    </div>
</ul>

But

public function end_lvl( &$output, $depth = 0, $args = array() )
{
    $output .= ($depth == 0) ?
        "\n" . dynamic_sidebar('sidebar-featured-shop') . "\n" .
        "\n</div>\n" . // .row
        "\n</div>\n" . // yamm-content
        "\n</ul>\n" // .dropdown-menu
        : "\n</ul>\n"; // else .subcat-ul
}

...renders

<div class="sidebar-featured">(Sidebar content)</div>
<ul class="nav navbar-nav>
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="//localhost:3000/shop/">Shop <b class="caret"></b></a> 
        <ul class="dropdown-menu">
            <div class="yamm-content">
                ...
            </div>
        </ul>
    </li>
</ul>

from yamm-nav-walker.

macdonaldr93 avatar macdonaldr93 commented on July 16, 2024

@jsbls sorry I went offline there for a while. Did you end up resolving this?

from yamm-nav-walker.

jsbls avatar jsbls commented on July 16, 2024

I can't remember! 😅 Let me go through the project and let you know. I think in the end what I did was add an Ads Plugin and insert the shortcode, but I'm not sure. Will update soon.

from yamm-nav-walker.

macdonaldr93 avatar macdonaldr93 commented on July 16, 2024

haha no problem! Just wanted to check in. Felt bad I left you hanging lol

from yamm-nav-walker.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.