• Hi all. I am developing a wordpress theme, but I have a problem: I can’t use shortcodes in my theme. I write:

    function display(){
     echo "Something";
    }
    
    add_shortcode('code', 'display');

    It shows [code] in frontend.
    In my theme I am getting pages like this:

    <?php
    			$mypages = get_pages( array( 'post_type' => 'page') );
    			foreach( $mypages as $page ) {
    				$content = $page->post_content;
    				if ( ! $content )
    				$content = qtrans_use($lang, $content );
    				?>
    				<li id="<?php echo $page->post_name;?>">
    					<a href="#!/"> </a>
    					<div class="entry"><?php echo $content;?></div>
    				</li>
    				<?php
    			}
    		?>

    What should I do make my theme support shortcodes.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Enable shortcode in theme’ is closed to new replies.