Forum Replies Created

Viewing 15 replies - 16 through 30 (of 53 total)
  • Thread Starter Mattaton

    (@mattaton)

    Ah, that’s what I figured. Thanks!
    Thankfully, I was able to do what I wanted without a plugin.

    Thread Starter Mattaton

    (@mattaton)

    I’m still pretty new to WP development. Can you give me an example of how the action would be used to add a crumb into the trail? I can handle building what the crumb looks like, I just don’t know how to use the hook.

    Thanks!

    Thread Starter Mattaton

    (@mattaton)

    I’ll check that out! I accomplished what I wanted with some custom php and jquery to inject it, but I’d rather handle it all server-side.

    Thanks!
    Matt

    Thread Starter Mattaton

    (@mattaton)

    I’ll check that out! I accomplished what I wanted with some custom php and jquery to inject it, but I’d rather handle it all server-side.

    Thanks!
    Matt

    Thread Starter Mattaton

    (@mattaton)

    Worked perfectly, Jesper!

    Thanks!!!

    Thread Starter Mattaton

    (@mattaton)

    HA! Thanks, Jesper! (It’s Matt, not Martin, by the way ?? )

    I can’t take full credit for the hack I have going. Someone far smarter than me on StackExchange helped me get that working. One of the requirements for it to work was that the post type could NOT be hierarchical. I’m not sure why, but I guess it’s because it causes a conflict when the post typically wants its parent to be of the same post type.

    I’ll try out your bit of code magic and see if it works!

    Thanks!
    Matt

    Thread Starter Mattaton

    (@mattaton)

    Nevermind, I used this in place of get_term_children():

    $children = get_terms(
        $taxonomy,
    	array(
    		'child_of' => $parent_term->term_id,
    		'orderby' => 'term_order',
    		'hide_empty'    => false
    		)
    	);
    Thread Starter Mattaton

    (@mattaton)

    I have cobbled together code by working with those that know more than me on StackExchange, etc. I’m pretty certain it utilizes the post_parent field from the post meta table in the database.

    It basically makes use of the core parent meta box and simple changes the options in the select to that of another post type.

    Here is the code that does the work:

    function episodes_attributes_meta_box($post) {
        $pages = wp_dropdown_pages(
        	array(
        		'post_type' => 'cartoon-series',
        		'selected' => $post->post_parent,
        		'name' => 'parent_id',
        		'show_option_none' => __('Choose a Cartoon Series'),
        		'sort_column'=> 'menu_order, post_title',
        		'echo' => 0
        	)
        );
        if ( ! empty($pages) ) {
            echo $pages;
        } // end empty pages check
    }
    add_action('add_meta_boxes', function() {
        add_meta_box('episodes-parent', 'Cartoon Series', 'episodes_attributes_meta_box', 'episodes', 'side', 'default');
    });

    Thread Starter Mattaton

    (@mattaton)

    Thanks, Thomas!

    Thread Starter Mattaton

    (@mattaton)

    Ah okay. I think my setup is a little too complicated for this to work. I’ve had to do some trickery to allow for a post type to have a parent from another post type. In this case, I don’t think your plugin realizes the posts do indeed have parents even though it’s not a hierarchical post type.

    The option you mentioned isn’t there. So, I assume it’s because the post type is not actually set as hierarchical.

    Thanks!

    Thread Starter Mattaton

    (@mattaton)

    I added a bit of jquery to get this done. Instead of submitting a form supplied by the plugin, I used this:

    $(".themes li").click(function (event) {
            var styleID = $(this).attr("data-switch");
    
            event.preventDefault();
    
            $.ajax({
                type: 'POST',
                url: window.location,
                data: {
                    user_stylesheet_switcher_choice: styleID
                },
                complete: function () {
                    window.location.reload(true);
                }
            });
    
            return false;
    
        });

    Then I just used the session variable set up by the plugin to highlight the currently selected theme in my UI.

    Works so far in my testing! ??

    Thread Starter Mattaton

    (@mattaton)

    Ah yes, you were right, that button wasn’t enabled. I think it was enabled on the free version by default.

    Since the Posts and All Posts go to the exact same place, it’s not as though I am hiding something I want to deny access to. It’s simply an aesthetic fix getting rid of two links that go to the exact same place that are side-by-side in the menu. Perfect use of the show/hide button. I’m, glad it’s available! ??

    Thanks!
    Matt

    Thread Starter Mattaton

    (@mattaton)

    I realized I had a mistake in my Publishers taxonomy. I had recreated it to change the slug and then forgot to attach it solely to the Books CPT again. Once I did that, the CPT was added into the breadcrumb as I wanted it.

    However, I do have some other sections where things will get one step deeper where I will have to try some other methods like a dummy page as a root page.
    I’ll cross that bridge when I get to it! ??

    Thanks!
    Matt

    Thread Starter Mattaton

    (@mattaton)

    Yeah, that’s exactly how I have it set up apart from having an actual page set up to target as the “root page” for the breadcrumb. I was just doing an archive template for the post type instead of setting up a dummy page. I’ll try the dummy page approach and see what happens.

    Thread Starter Mattaton

    (@mattaton)

    Yeah, it does seem like everything is working as it’s supposed to (whether desirable or not). Sorry, I should have marked it as resolved after my last comment.

    Thanks!

Viewing 15 replies - 16 through 30 (of 53 total)