Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1273477
    chrishdunn
    Participant

    Hi…I’ve no doubt missing something simple, but can’t get shortcodes working in my posts … here’s an example … http://edgazette.co.uk/uncategorized/prp/

    Am using this code in my content-the-content.php file …

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_CONTENT-THE-CONTENT.PHP
    // -----------------------------------------------------------------------------
    // Display of the_content() for various entries.
    // =============================================================================
    
    ?>
    
    <?php
    function get_last_words($amount, $string)
    {
        $amount+=1;
        $string_array = explode(' ', $string);
        $totalwords= str_word_count($string, 1, 'xxxx');
        if($totalwords > $amount){
            $words= implode(' ',array_slice($string_array, count($string_array) - $amount));
        }else{
            $words= implode(' ',array_slice($string_array, count($string_array) - $totalwords));
        }
    
        return $words;
    }
    ?>
    
    <?php do_action( 'x_before_the_content_begin' ); ?>
    
    <div class="entry-content content">
    
    <?php do_action( 'x_after_the_content_begin' ); ?>
    
      <? 
    	if ( is_singular('post') ) {
    
    if (in_category('news-in-a-nutshell') OR in_category('shrektheteacher') OR in_category('uncategorized') OR in_category('the-editor')) {
    
    echo get_the_content();
    
    } else {
    
    $postlength = 600;
    
    //if (strlen(get_the_content()) < $postlength) {
        
    //echo get_the_content();
    
    //}
    
    if ($linkpos = strpos(prefix_me_truncate(get_the_content(),$postlength),'<div class="edgpostlink">',1) > 0) {
    
    echo get_the_content();
    
    } else {
    
    echo prefix_me_truncate(get_the_content(),$postlength);
    
    $linkpos = strpos(get_the_content(),'<div class="edgpostlink">',1) ;
    echo substr(get_the_content(), $linkpos, $linkpos + 100);
    
    } 
    }
    
    //          echo do_shortcode ('[shareaholic app="share_buttons" id="21693601"]');
    
              echo sharing_display();
    
    //        echo do_shortcode ('[shareaholic app="recommendations" id="21693609"]');
    
    ?>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- edgresponsivehoz -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-2214146753628542"
         data-ad-slot="9441017351"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    
    <?php
    
              wp_related_posts();
    
    //  echo do_shortcode('[jetpack-related-posts]');		
    
    	} else {
    		the_content();
    	}
      ?>
      <?php x_link_pages(); ?>
    
    <?php do_action( 'x_before_the_content_end' ); ?>
    
    </div>
    
    <?php 
    //Do the below to trigger the Top 10 plugin hit counter. Hide the class in css.
    echo tptn_add_viewed_count( ' ' );
    ?>
    
    <?php do_action( 'x_after_the_content_end' ); ?>

    Would be grateful if you can give me some pointers … Thanks.

    #1273493
    Nico
    Moderator

    Hi There,

    Would you mind sharing us details of what you want to achieve and please share us your admin credentials and FTP so we could check your setup further.

    Don’t forget to set it as private reply.

    Thanks.

    #1293471
    chrishdunn
    Participant

    Thanks, managed to achieve what I needed by using a page instead of a post.

    Chris.

    #1293742
    Prasant Rai
    Moderator

    You are most welcome. 🙂

  • <script> jQuery(function($){ $("#no-reply-1273477 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>