Shortcode being displayed
-
Hello, I have a custom template that I have developed for a company. This template is from their previous website. I have converted it to WordPress.
My problem that I am having is shortcodes are being displayed
example
[orbit-slider] will display instead of the slider being displayed. any clue as into why this is happening?
-
where exactly is the shortcode displayed?
can you post a link to the site?does the shortcode belong to a plugin?
https://www.cloudleasing.com/prestige/contact-us/
yes it does. I cannot for the life of me figure it out..
The first thing that comes to mind is that there is no code handling the shortcode. Is there a plugin that might have been deactivated?
No, The plugin is enabled. I was thinking it could be cause by my functions or sidebar.php files I have, but these have not effected shortcodes before..
This is my sidebar.php
<?php $sid = ""; $pref = "sidebar-"; if (is_single()){ // sidebar explicitly defined for single blog post $sid = "sidebar-single"; } elseif (is_page()){ if ($post->post_parent == 0 || is_active_sidebar('sidebar-'.$post->ID)){ // no parent to inherit, or not necessary because the sidebar has been set $sid = $pref.$post->ID; } else { if (is_active_sidebar('sidebar-'.$post->post_parent)){ // parent exists and has a sidebar $sid = $pref.$post->post_parent; } else { // parent doesn't exist, check all for sidebars foreach (get_post_ancestors($post) as $ancestor => $id){ if (is_active_sidebar($pref.$id)){ $sid = $pref.$id; break; } } } } } elseif (is_home()){ // sidebar for blog list page $sid = $pref.get_option('page_for_posts'); } ?> <?php if (!empty($sid) && function_exists('is_dynamic_sidebar') && is_active_sidebar($sid)){ ?> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar($sid)): ?> <br /> <?php endif; ?> <?php } ?>
and my functions.php
<?php if (function_exists('register_sidebar')){ register_sidebar(array('name'=>'Single Post Sidebar', 'id' => 'sidebar-single', 'before_widget' => '<div id="sidebar">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>' )); // Dynamic Widgets $myPages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish'"); foreach ($myPages as $q ){ $id = 'sidebar-'.$q->ID; $namePref = "Parent - "; if ($q->post_parent != 0){ $namePref = "Child - "; } $sbtitle = $namePref . $q->post_title; if ($sbtitle && function_exists('register_sidebar')){ register_sidebar(array( 'id' => $id, 'name' => $sbtitle , 'before_widget' => '<div id="sidebarbottom">', //Register the sidebar Bottom so that it will display different div's... 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>' )); } } } // CUSTOM ADMIN MENU LINK FOR ALL SETTINGS function all_settings_link() { add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php'); } add_action('admin_menu', 'all_settings_link'); // REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN global $user_login; get_currentuserinfo(); if (!current_user_can('update_plugins')) { // checks to see if current user can update plugins add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) ); } ?>
Also this is my contact us page I am calling
<?PHP get_header(); /* Template Name: Contact-Us-Page */ ?> <td> </td> </tr> <tr> <td><img src="<?PHP echo bloginfo('template_directory'). '/images/contact_custom_cabinets.gif'; ?>" width="150" height="24" /></td> </tr> <tr> <td><h1><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="25" /> <?php $post_id = 151; $queried_post = get_post($post_id); echo $queried_post->post_content; ?> </h1></td> </tr> <tr> <td><table width="632" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="348" valign="top"><table width="348" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="1" /></td> </tr> <tr> <td height="8"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="8" /></td> </tr> <tr> <td><img src="<?PHP echo bloginfo('template_directory'). '/images/subheader_contactmail.gif'; ?>" width="92" height="20" /></td> </tr> <tr> <td valign="top"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="6" /></td> </tr> <tr> <td valign="top"><h2> <?php $post_id = 156; $queried_post = get_post($post_id); echo $queried_post->post_content; ?> </h2></td> </tr> <tr> <td> <?php $post_id = 164; $queried_post = get_post($post_id); echo $queried_post->post_content; ?> </td> </tr> </table></td> <td width="20"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="20" height="1" /></td> <td width="264" valign="top"><table width="264" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="8" /></td> </tr> <tr> <td><img src="<?PHP echo bloginfo('template_directory'). '/images/secondcol_top.gif'; ?>" width="264" height="10" /></td> </tr> <tr> <td background="<?PHP echo bloginfo('template_directory'). '/images/secondcol_expander.gif'; ?>"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="2" /></td> </tr> <tr> <td background="<?PHP echo bloginfo('template_directory'). '/images/secondcol_expander.gif'; ?>"><table width="234" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="10" /></td> </tr> <tr> <td class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/subheader_phoneandfax.gif'; ?>" width="228" height="24" /></td> </tr> <tr> <td class="bottom"> <?php $post_id = 159; $queried_post = get_post($post_id); echo $queried_post->post_content; ?> </td> </tr> <tr> <td><span class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="10" /></span></td> </tr> </table></td> </tr> <tr> <td background="<?PHP echo bloginfo('template_directory'). '/images/secondcol_expander.gif'; ?>"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="2" /></td> </tr> <tr> <td background="<?PHP echo bloginfo('template_directory'). '/images/secondcol_expander.gif'; ?>"><table width="234" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="10" /></td> </tr> <tr> <td class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/subheader_mailingaddress.gif'; ?>" width="228" height="24" /></td> </tr> <tr> <td class="bottom"><?php $post_id = 161; $queried_post = get_post($post_id); echo $queried_post->post_content; ?> </td> </tr> <tr> <td><span class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="16" /></span></td> </tr> <tr> <td class="bottom"><h2><a href="<?PHP site_url(); ?>/prestige/privacy">Privacy Policy</a> </h2></td> </tr> <tr> <td class="bottom"> </td> </tr> <tr> <td class="bottom"> </td> </tr> <tr> <td class="bottom"><img src="<?PHP echo bloginfo('template_directory'). '/images/spacer.gif'; ?>" width="1" height="10" /></td> </tr> <tr> <td class="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><div align="center"><a href="https://www.bbb.org/richmond/business-reviews/cabinet-manufacturer/prestige-cabinets-countertops-in-richmond-va-33001110/#bbbonlineclick" target="_blank"><img src="../images/bbb_contact.gif" alt="Click here for BBB Business Review" width="92" height="37" border="0" /></a><br /> <a href="https://www.bbb.org/richmond/business-reviews/cabinet-manufacturer/prestige-cabinets-countertops-in-richmond-va-33001110/#bbbonlineclick" target="_blank" class="bottom" id="bbbo1912lnk">Click here for BBB Business Review</a> </div></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><img src="<?PHP echo bloginfo('template_directory'). '/images/secondcol_bottom.gif'; ?>" width="264" height="11" /></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td> </td> <?PHP get_footer(); ?>
Could you paste the code that handles the shortcode?
I am using the Quform Plugin for the code that I want to display, I have tried several different plugins that use shortcodes but none of them work.
if you output the content of a post or page like so:
echo $queried_post->post_content;
then any shortcode in the content will not get parsed;
you will need to apply the ‘content’ filter;
try for example:echo apply_filters('the_content',$queried_post->post_content);
Ahh Thanks man!! Worked like a Charm. Now that explains why none of my shortcodes worked!! Thanks man!
- The topic ‘Shortcode being displayed’ is closed to new replies.