WordPress.org

Support

Support » Miscellaneous » [Resolved] Nested php function help!

[Resolved] Nested php function help!

  • A little nested php question:
    I want to retrieve wordpress bookmarks with a certain category:
    <?php wp_list_bookmarks('title_li=&category_name=CUSTOMFIELD-ISSUE'); ?>
    and this category will be set on posts with the custom field ‘issue’:

    <?php
    global $wp_query;
    $postid = $wp_query->post->ID;
    echo get_post_meta($postid, 'issue', true);
    ?>

    How do I merge these two functions? My php-writing needs work, I know ;O)
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • If you are using PHP 5.3 you can get more Javacript-like behaviour with an anonymous function:

    <?php
    function outer() {
        $inner=function() {
            echo "test\n";
        };
    
        $inner();
    }
    
    outer();
    outer();
    
    inner(); //PHP Fatal error:  Call to undefined function inner()
    $inner(); //PHP Fatal error:  Function name must be a string
    ?>

    Output:

    test
    test

    Not sure I understand your reply Apsira. Anyway, I got there in the end, here is the code I used for any one who’s interested:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I think Apsira is spamming, but I just can’t tell.

    Can you post the code on pastebin? 🙂

    Yeah I think Aspira was spamming too.
    My code is in the pastebin: http://pastebin.com/myMq1EaQ
    Thanks Ipstenu

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Nested php function help!’ is closed to new replies.
Skip to toolbar