breadcrumb not working
-
Hi there,
Because I’m not a fan of plugins, I’m trying to make a breadcrumb with only php. I’m running into an if / elseif error that has costed a few hours of puzzling already.
The breadcrumbs looks something like this:<?php if( $post->ID == 1 ) { // Page1 ?> <div id="page1"><a href="/page1">page1</a> » Article: <?=$post->single_post_title()?></div> <? } else { ?> Page1 <? } elseif ( $post->ID == 2 ) { // Page2 ?> <div id="page2"><a href="/page2">Page2</a> » <?=$post->post_title()?></div> <? } else { ?>Page2<? } elseif ( $post->ID == 3 ) { // Page3 ?> <div id="page3">Page3</div> <? } elseif ( $post->ID == 4 ) { // Page4 ?> <div id="page4">Page4</div> <? } else { ?> <?=$post->single_post_title()?> <? } ?>
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
An parser error is found in the line of the first elseif. What I assume because the if is already closed by the else, that’s supposed to be merely an alternative, if the single_post _title isn’t found.
Any suggestions (no plug ins, please) are more than welcome.
Thanks in advance!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘breadcrumb not working’ is closed to new replies.