Forums

[resolved] Get Page excerpt inside Custom Menu (7 posts)

  1. ameraz
    Member
    Posted 1 year ago #

    Hello guys!!
    hopefully someone can help me out!

    I wish to add below the anchor of a Page, inside a Custom Menu, the Page excerpt, as a brief abstract/description of the Page itself on the menu.

    So first I activated the Page excerpt in the functions.php with this:

    add_post_type_support( 'page', 'excerpt' );

    then I declared my Custom Menu in my header.php as follows:

    <?php wp_nav_menu(array('menu' => 'Main Nav Menu', 'link_after' => '<div class="abstract"><strong>Lorem ipsum</strong></div>' )); ?>

    I wish to replace the "Lorem ipsum" text with something that would extract the excerpt of each page dynamically.

    I already tried the_excerpt(); and get_the_excerpt(); functions with no succes, probably because Im using them outside of the loop..

    Any ideas?!
    Thank you in advance

  2. vtxyzzy
    Member
    Posted 1 year ago #

    This is the third time you have asked this question. What you want may be possible using a custom 'walker' class for wp_nav_menu, but I believe the solution is too complex to be done in this forum.

  3. ameraz
    Member
    Posted 1 year ago #

    vtxyzzy, thank you for your interest and your tip...
    do you know any other forum you may recommend where I can find some help then?

  4. vtxyzzy
    Member
    Posted 1 year ago #

    You would probably need to hire someone to do the work.

  5. ameraz
    Member
    Posted 1 year ago #

  6. vtxyzzy
    Member
    Posted 1 year ago #

    @ameraz - thanks for the tip.

  7. gillespieza
    Member
    Posted 3 months ago #

    @ameraz you might try asking on http://wordpress.stackexchange.com - you can get some really good, complex questions answered there.

    By the way - did you even figure it out? I'm looking to do the same thing (that's how I found your post).

Topic Closed

This topic has been closed to new replies.

About this Topic