different teasers on different groups of pages (above the loop). (2 posts)

  1. ysr5
    Posted 4 years ago #

    hi everyone,
    iam new to php and wp so dont be too hard to me :-)

    i want to do something like that:

    i have a custom menu like

    lets say i want to position a teasers on every of that menu entries. depending on the 1stLevel menuentry on every children the same teaser should be used. on a different 1stLevel menuentry an on every children a different teaser should be shown.
    eg: on "team" and every children like "aTeam" or "worstMatch" teaser01 should be shown
    on "fans" and every children teaser02 should be shown.

    i thought on something like this:

    // get current side id
    global $wp_query;
    $page_id = $wp_query->get_queried_object_id();
    // define siteids for the different menutrees
    $team_site_ids = array(IDsOfParentAndEveryChildren);
    $fans_site_ids = array(IDsOfParentAndEveryChildren);
    // check in which menu and display belonging teaser
    if (in_array($page_id, $team_site_ids)) {
       // load teaser02 into my div before loop
    if (in_array($page_id, $fans_site_ids)) {
       // load teaser02 into my div before loop

    iam sure this is not the elegant way cuz there will be to much hard coded lines and i will have more than just two menutrees. so plz give me some ideas how you would solve that and if theres a similiar plugin already availible ;-)

  2. ysr5
    Posted 4 years ago #

    nobody? :-(

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.