WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Breadcrumbs - Wrapping Function Name into current breadcrumbs code (14 posts)

  1. berestored
    Member
    Posted 1 year ago #

    Hi,

    A breadcrumbs question. I have included the code found here for the breadcrumbs in my function.php as instructed. http://tri.be/using-conditionals-to-show-breadcrumbs-for-events-and-venues/.

    I am having trouble wrapping the function statement tribe_breadcrumbs(); into my current breadcrumbs code which is:

    <div id="page-content">
    <?php // Breadcrumbs
    if ( ($udesign_options['show_breadcrumbs'] == 'yes') && class_exists('simple_breadcrumb') ) : ?>
    <div class="container_24">
    <?php $breadcrumbs_go = new simple_breadcrumb; ?>
    </div>
    <?php else : ?>
    <div class="no-breadcrumbs-padding"></div>
    <?php endif; ?>
    <?php endif;

    Can someone tell me how I need to modify my statement to make it work. Currently the breadcrumb will pull an event when the main calendar shows.
    Home → Essential Oils Chemical Compounds

    I need to it to look like this for the main calendar with no specific event listed.
    Home → Events

    Thanks for your help in advance.

    Manning

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    Hey Manning. Thanks for your note here, and for using The Events Calendar. While I'm not sure about this one myself (it's a bit outside my area of expertise), I have asked Jonah - who wrote that tut you linked to - if he can comment here directly to try and point you in the right direction.

    No guarantees, but we'll do what we can. Stay tuned and thanks for your patience so far.

  3. berestored
    Member
    Posted 1 year ago #

    Thank you very much. Any help you can offer would be greatly appreciated. I checked with a friend and they said to possibly wrap it in an include statement which would call an external php file. (i.e. include events.php). I would need to know the code to put in the events.php file if an include or require statement will work.

    Let me know when you find out something. I have a little bit of time before my launch so I have some flexibility. Mid Feb is launch time so I will need to figure out a solution by then. I am interested in purchasing the pro version and facebook add-on but wanted to get the breadcrumbs issue sorted first.

    Thanks again.

  4. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    We should be able to get a response much quicker than your deadline - hoping to have Jonah take a look at some point this afternoon, as this is the first on his list of dot-org threads.

  5. jonahcoyote
    Member
    Posted 1 year ago #

    Hi Manning,

    It looks like you are using an entirely different breadcrumb function. In which case you'll need to dig into that function and add specific conditional code to check for specific events pages like I used in the tribe_breadcrumbs() function. You should be able to use similar conditional code but you'll likely need to change some of the other code to output the breadcrumbs however the simple_breadcrumb() function does that.

    Sorry I can't offer up more here. Good luck!

    - Jonah

  6. berestored
    Member
    Posted 1 year ago #

    Hi Robb and Jonah,

    I will dig through that function in my functions.php file and see if I can include an "include or require" statement, within the function using the conditional statements that I saw in another post. I am meeting with someone on Wednesday of next week who is a bit more advanced than me in php so I am hoping he and I working together can get it sorted out.

    Thanks for getting back to me. If I have more questions, I will post them here or if I get it figured out I will also post the solution here for others

    Thanks,
    Manning

  7. jonahcoyote
    Member
    Posted 1 year ago #

    Hi berestored,

    That sounds good. Yes, please let us know if you need anything else. We'll do our best to help you.

    Cheers,
    Jonah

  8. berestored
    Member
    Posted 1 year ago #

    Thanks Jonah. I am going to leave the thread open so that I can post any updates here. We will get it figured out, I am sure.

  9. berestored
    Member
    Posted 1 year ago #

    Hi Robb and Jonah,

    Here is the simple breadcrumb code that is called using the function listed at the top. Do you know just from looking at it how, what, and where I could add your conditional statements? No worries, if not, I am still meeting with my friend next week but thought this would provide some clues.

    Let me know.

    class simple_breadcrumb {
        var $options;
    
        function simple_breadcrumb() {
                $this->options = array(//change this array if you want another output scheme
                'before' => '<span class="breadarrow"> ',
                'after' => ' </span>',
                'delimiter' => '→'
            );
            $markup = $this->options['before'] . $this->options['delimiter'] . $this->options['after'];
            global $post;
            echo '<p class="breadcrumbs"><a href="' . get_bloginfo('url') . '">';
            //bloginfo('name');
            esc_html_e('Home', 'udesign');
            echo "</a>";
            if (!is_front_page()) {
                echo $markup;
            }
            $output = $this->simple_breadcrumb_case($post);
            echo "<span class='current_crumb'>";
            if (is_page() || is_single()) {
                the_title();
            } else {
                echo $output;
            }
            echo " </span></p>";
        }
    
        function simple_breadcrumb_case($der_post) {
            global $post;
            $markup = $this->options['before'].$this->options['delimiter'].$this->options['after'];
            if (is_page()){
                if($der_post->post_parent) {
                    $my_query = get_post($der_post->post_parent);
                    $this->simple_breadcrumb_case($my_query);
                    $link = '<a href="';
                    $link .= get_permalink($my_query->ID);
                    $link .= '">';
                    $link .= ''. get_the_title($my_query->ID) . ''. $markup;
                    echo $link;
                }
                return;
            }
            if(is_single()){
                $category = get_the_category();
                if (is_attachment()){
                    $my_query = get_post($der_post->post_parent);
                    $category = get_the_category($my_query->ID);
                    if( $category != null ) {
                    $ID = $category[0]->cat_ID;
                    echo get_category_parents($ID, TRUE, $markup, FALSE );
                    }
                    previous_post_link("%link $markup");
    
                } elseif ( get_post_type( $post ) == 'post' ) {
                    $ID = $category[0]->cat_ID;
                    get_category_parents_for_breadcrumbs( $ID, TRUE, $markup, FALSE );
    
                } else { // custom types
                    echo ucwords( get_post_type( $post ) ) . $markup;
                }
                return;
            }
            if(is_category()){
                $category = get_the_category();
                $i = $category[0]->cat_ID;
                $parent = $category[0]-> category_parent;
    
                if($parent > 0 && $category[0]->cat_name == single_cat_title("", false)){
                    echo get_category_parents($parent, TRUE, $markup, FALSE);
                }
                return single_cat_title('',FALSE);
            }
            if (is_tax()) { // taxonomy
                $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
                echo $term->name;
            }
            if(is_author()){
                $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
                return esc_html__('Author: ', 'udesign').$curauth->nickname;
            }
            if(is_tag()){ return esc_html__('Tag: ', 'udesign').single_tag_title('',FALSE); }
            if(is_404()){ return esc_html__('404 - Page not Found', 'udesign'); }
            if(is_search()){ return esc_html__('Search', 'udesign'); }
            if(is_year()){ return get_the_time('Y'); }
            if(is_month()){
                $k_year = get_the_time('Y');
                echo "<a href='".get_year_link($k_year)."'>".$k_year."</a>".$markup;
                return get_the_time('F');
            }
            if(is_day() || is_time()){
                $k_year = get_the_time('Y');
                $k_month = get_the_time('m');
                $k_month_display = get_the_time('F');
                echo "<a href='".get_year_link($k_year)."'>".$k_year."</a>".$markup;
                echo "<a href='".get_month_link($k_year, $k_month)."'>".$k_month_display."</a>".$markup;
                return get_the_time('jS (l)');
            }
        }
    }

    [Please post code or markup snippets between backticks or use the code button. Or better still - use a pastebin. Your posted code has been permanently damaged/corrupted by the forum's parser.]

    BTW - I am using the u-Design theme from Themeforest.
    http://themeforest.net/item/udesign-wordpress-theme/full_screen_preview/253220

    Thanks again for your help in advance

  10. jonahcoyote
    Member
    Posted 1 year ago #

    Hey berestored,

    Can you please repost your code to http://snippi.com/ - it looks like some of it may have gotten cut off or corrupted.

    Thanks,
    Jonah

  11. berestored
    Member
    Posted 1 year ago #

    Hi Jonah,

    Thanks for the response.

    Here is the code URL.

    Code in breadcrumbs.php
    http://snippi.com/s/he1ea4y

    Code in functions.php
    http://snippi.com/s/adi9971

    Thanks for your help.

    Manning

  12. jonahcoyote
    Member
    Posted 1 year ago #

    Hi Manning,

    Here is generally what you're going to want to do within the breadcrumbs function: http://snippi.com/s/siesrlc

    I can't spend time on the specifics of outputting the correct code for each condition but the conditions for the different event related pages should at least be in the right place in the code...

    Hopefully that points you in the right direction.

    - Jonah

  13. berestored
    Member
    Posted 1 year ago #

    Hi Jonah,

    Thank you for this. I know you don't have the time and I wouldn't expect you to write the code, however, can you give me a sample of a condition, say for outputting the breadcrumb : Home > Events.

    If I can get a sample condition statement I can write the others. I read code well but writing it from scratch is a bit challenging for me.

    Thanks a million again!

    Manning

  14. jonahcoyote
    Member
    Posted 1 year ago #

    Hi berestored,

    I took a crack at it but it's too complicated for me to be able to spend much time on. You should be able to use those conditional statements to detect event related pages and then modify the breadcrumb output, but I'm not sure why it's not working. Sorry man, you're on your own... Good luck!

    - Jonah

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.