• greetings & salutations.

    The folks i work for want me to replicate the functionality of this site in wordpress
    https://maxartcreative.com/

    my specific problem is replicating the sub-navigation found on a page like this:
    https://maxartcreative.com/portfolio.php?id=348

    Please note the sub-navigation, Portfolio, Bio, Multimedia, Red Carpet,
    if you browse the site a bit, you’ll notice that not all artists have a page for each of these.
    but each artist has at least a portfolio

    I’ve setup custom post types for each sub-navigation menu item, Portfolio, Bio, Multimedia, Red Carpet,

    so some artists have all 4, others only have a few,
    but each custom post type has the same name for each artist,

    so for example, Megan Thompson has a custom post type Portfolio with her name as the title, and a custom post type for Bio also with her name as the title,

    what i need to do is this:
    in a custom post template, build a that sub-menu based on weather or not a custom post type with that name exists or not.

    i really hope this makes sense, i’m going mildly crazy trying to get this to work. I’ve browsed the forums and run this by a few go-to ppl for WP but they can’t figure out what i’m trying to do.

    at this point i’m open to any other way to get this to work,
    i realize trying to setup a custom query and return results based on custom post types all with the same name is wonky but i have to USER proof / make it as easy as possible.

    I keep trying to run through what i want to do in my head,

    Within a custom post template i need to query four custom post types for a name that matches the title of the current post (which is one of those custom post types),
    then i have to see if there even is a custom post type with that name and build the sub menu with the permalink

    here’s the guts of what i’ve been beating on. of course it’s busted.
    https://wordpress.pastebin.com/7URpvu5i

    at this point i’m open to any suggestions, especially an easier way to do it.
    i do appreciate WP for what it does but i’m wholly visual and the semantics throw me.

    oh yes, and of course thx to anyone willing to help me tackle this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter joel@ahso

    (@joelahso)

    Hmm, well, for whatever reason i seem to be cursed with being that guy who gets to answer his own forum posts. Good times, good times.
    SO i went and got one of my instructors from Art Institute to help me out.
    He showed my how WP handles its raw DB queries,

    from that , i was able to back up and use some WP to query the DB ‘properly’,
    but here’s the rub, once i get that query back, i need to loop thru the results and display the permalink of each returned result.

    this will make sense in a minute.

    so what i’m doing in the meantime (which makes my inner dev cringe)
    is a number of sub loops, each with a new WP_query,
    then building the menu item i need.

    So i;m still looking for a better way to do this, because there is always a better way, right? well, not when the client needs it yesterday, but for my own sanity and experience.

    if you’re bored: https://wordpress.pastebin.com/PU17xeJm

    Good Luck to anyone else with this problem. If i ever streamline the thing i’ll post it here.

    i can get a better WP_query with all the post_types and same name in it,

    $thisname = $post->post_title;
    $my_freakin_query = new WP_query(array('post_type' => array('portfolio','bio','multimedia','red-carpet'),'post_title' => '$thisname'));

    but am having trouble looping thru the results and displaying the permalink for each

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How To setup dynamic menu based on if custom post type with same name exists’ is closed to new replies.