Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author curtismchale

    (@curtismchale)

    What are you using to build the breadcrumbs?

    I certainly could be the same issue, but they never got back to me with more information so I have no solution to that issue.

    Thread Starter Mpampirina

    (@mpampirina)

    This function is called:

    function mfn_breadcrumbs() {
    
    	global $post;
    	$homeLink = home_url();
    
    	$translate['home'] = mfn_opts_get('translate') ? mfn_opts_get('translate-home','Home') : __('Home','rocco');
    	$translate['you-are-here'] = mfn_opts_get('translate') ? mfn_opts_get('translate-you-are-here','You are here:') : __('You are here:','rocco');
    
    	echo '<ul class="breadcrumbs">';
    // 	echo '<li>'. $translate['you-are-here'] .'</li>';
    	echo '<li class="home"><i class="icon-home"></i> <a href="'. $homeLink .'">'. $translate['home'] .'</a> <span><i class="icon-angle-right"></i></span></li>';
    
    	// Blog Category
    	if ( is_category() ) {
    		echo '<li><a href="'. curPageURL() .'">' . __('Archive by category','rocco').' "' . single_cat_title('', false) . '"</a></li>';
    
    	// Blog Day
    	} elseif ( is_day() ) {
    		echo '<li><a href="'. get_year_link(get_the_time('Y')) . '">'. get_the_time('Y') .'</a> <span><i class="icon-angle-right"></i></span></li>';
    		echo '<li><a href="'. get_month_link(get_the_time('Y'),get_the_time('m')) .'">'. get_the_time('F') .'</a> <span><i class="icon-angle-right"></i></span></li>';
    		echo '<li><a href="'. curPageURL() .'">'. get_the_time('d') .'</a></li>';
    
    	// Blog Month
    	} elseif ( is_month() ) {
    		echo '<li><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> <span><i class="icon-angle-right"></i></span></li>';
    		echo '<li><a href="'. curPageURL() .'">'. get_the_time('F') .'</a></li>';
    
    	// Blog Year
    	} elseif ( is_year() ) {
    		echo '<li><a href="'. curPageURL() .'">'. get_the_time('Y') .'</a></li>';
    
    	// Single Post
    	} elseif ( is_single() && !is_attachment() ) {
    
    		// Custom post type
    		if ( get_post_type() != 'post' ) {
    			$post_type = get_post_type_object(get_post_type());
    			$slug = $post_type->rewrite;
    
    			if( $slug['slug'] == mfn_opts_get('portfolio-slug','portfolio-item') && $portfolio_page_id = mfn_opts_get('portfolio-page') )
    			{
    				echo '<li><a href="' . get_page_link( $portfolio_page_id ) . '">'. get_the_title( $portfolio_page_id ) .'</a> <span><i class="icon-angle-right"></i></span></li>';
    			} else {
    				echo '<li><a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> <span><i class="icon-angle-right"></i></span></li>';
    			}
    			echo '<li><a href="' . curPageURL() . '">'. wp_title( '',false ) .'</a></li>';
    
    		// Blog post
    		} else {
    			$cat = get_the_category();
    			$cat = $cat[0];
    			echo '<li>';
    				echo get_category_parents($cat, TRUE, ' <span><i class="icon-angle-right"></i></span>');
    			echo '</li>';
    			echo '<li><a href="' . curPageURL() . '">'. wp_title( '',false ) .'</a></li>';
    		}
    
    	// Taxonomy
    	} elseif( get_post_taxonomies() ) {
    
    		$post_type = get_post_type_object(get_post_type());
    		if( $post_type->name == 'portfolio' && $portfolio_page_id = mfn_opts_get('portfolio-page') ) {
    			echo '<li><a href="' . get_page_link( $portfolio_page_id ) . '">'. get_the_title( $portfolio_page_id ) .'</a> <span><i class="icon-angle-right"></i></span></li>';
    		}
    
    		echo '<li><a href="' . curPageURL() . '">'. wp_title( '',false ) .'</a></li>';
    
    	// Page with parent
    	} elseif ( is_page() && $post->post_parent ) {
    		$parent_id  = $post->post_parent;
    		$breadcrumbs = array();
    		while ($parent_id) {
    			$page = get_page($parent_id);
    			$breadcrumbs[] = '<li><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a> <span><i class="icon-angle-right"></i></span></li>';
    			$parent_id  = $page->post_parent;
    		}
    		$breadcrumbs = array_reverse($breadcrumbs);
    		foreach ($breadcrumbs as $crumb) echo $crumb;
    
    		echo '<li><a href="' . curPageURL() . '">'. get_the_title() .'</a></li>';
    
    	// Default
    	} else {
    		echo '<li><a href="' . curPageURL() . '">'. get_the_title() .'</a></li>';
    	}
    
    	echo '</ul>';
    }

    is this any helpful?

    Plugin Author curtismchale

    (@curtismchale)

    I can see why it would cause issues. My plugin modifies what will match things like is_archive and I wouldn’t be surprised if it changed how some of the other conditionals worked.

    So is this an actual plugin or just a function you grabbed from somewhere?

    Have a link so I can get it as well and see about doing some testing to resolve the issue?

    Thread Starter Mpampirina

    (@mpampirina)

    Sure. The code above is taken from my parent template and the link of the website is here: https://goo.gl/hT785G (here is the page i got the screenshot from).

    Well, one interesting fact: Although I have deactivated the plugin, the page categories and tags I previously set, are stored. And when I query for pages with a specific tag, they show up.

    So, at the moment, I have deactivated the plugin in order to have the breadcrumbs, but I use the functionality it provided me before, when it was activated.

    Plugin Author curtismchale

    (@curtismchale)

    I’d expect the tags/categories to stay with the pages since it’s a relationship saved in the database.

    I could write a clean up routine to find all pages when you uninstall the plugin and remove the tags/categories but no one has needed it yet.

    I took a look at the code and I really don’t think that I can change anything with my plugin to deal with the breadcrumbs or we’d loose pages in search and on archive pages.

    The breadcrumb code could be changed to exclude pages though using the is_page conditional.

    Is the theme you’re using from a commercial theme shop or Themeforrest? Do you have a link to the theme you’re using at it’s source of download?

    Thread Starter Mpampirina

    (@mpampirina)

    Hello again.

    Yes it is a commercial theme from themeforest (Rocco). I am… not sure I could provide a download link (I have bought it) but you could find one, I’m sure ?? .

    No, no, please don’t write a clean up! It’s fine as it is, at least for me, because I can activate the plugin when i create a new page (which is not often, now that the website has taken its shape), set the categories for the pages, and then deactivate it, using the functionality and having my breadcrumbs work correctly.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Activating plugin breaks the breadcrumps!’ is closed to new replies.