This is the code I am working with:
echo '<a href="' . bloginfo('template_directory') . $slug['slug'] . '">' . $post_type->labels->singular_name . '</a>' .$markup;
It currently links correctly but shows the entire http string before the link. Example: http://www.blah.com/blah/blahPortfolio . When it should be just "Portfolio". Fresh eyes on this would be so helpful.
There are two errors that I can see:
<?php bloginfo('template_directory'); ?>
<?php bloginfo('template_directory'); ?>
If you are using echo
it means <?php
tag is already open so use only bloginfo('template_directory')
/>
) You use only one (ie >
) So the code will be like this:
echo '<a href="' . bloginfo('template_directory') . '/thepage.php' . $slug['slug'] . '">' . $post_type->labels->singular_name . '</a>';
试试这个代码块,让我知道-
echo '<a href="' . '<?php bloginfo('template_directory'); ?>'.'thepage.php />' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a>';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.