Styling text and images in the_content()

I think the problem is the way you use the foreach with HTML inside. I usually use this way, so try perhaps to modify your code like this : <?php if (have_posts()) { while (have_posts()) { the_post(); the_content(); // get_template_part( ‘template-parts/content’,’article’ ); $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ … Read more

Adding to the_content or a variable from within a shortcode function

I think, I would simply store all the definitions during the glossary_shortcode() execution in a global variable and serve them at the end of some hook like the_content. function glossary_shortcode( $atts = array(), $shortcode_content = null ) { // Your code can be kept identical, just store the $glossary_term_object somewhere. global $glossaries; $glossaries = $glossaries … Read more

How to filter the_content() & include content from template

My guess is that single-template.php uses the_content. Now think about what happens: Your filter causes single-template.php to load single-template.php uses the_content So single-template.php loads again Which uses the_content Which loads single-template.php Which uses the_content … I am not entirely sure how to fix that, as your question is light on detail. It is hard to … Read more

Adding the_date inside tags around the_content

You could use the the_content filter, like below (untested). The only thing is, that will add the date pretty much everywhere that your posts show up on your site, unless you add some logic to determine where it’s being called from. If that’s OK, give it a shot. add_filter(‘the_content’, ‘add_post_date’); function add_post_date($content) { global $post; … Read more

Removing permalink from post thumb in twentyeleven

No idea, never used twenty eleven theme. I opened the theme files. Check out showcase.php around Line 104-118. Should be on line 115 – just remove the anchor wrapping the post thumb, <a href=”https://wordpress.stackexchange.com/questions/52498/<?php the_permalink(); ?>” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘twentyeleven’ ), the_title_attribute( ‘echo=0’ ) ); ?>” rel=”bookmark”><?php the_post_thumbnail( $thumbnail_size ); ?></a>

How to split text text text into array

Firstly, you need to remove the paragraph tags that were added by the wp_autop filter. There’s another answer that covers this pretty well: Is there an uw-wp_autop function? I’m going to change the function a little for our purposes (based on the markup example you gave): function reverse_wpautop( $s ) { // Strip newlines $s … Read more

Appending code to the_content

You are looking to filter the_content. In your theme’s functions.php or in a plugin: function wpse74288_content_filter( $content ) { /* save field into variable, such as to call get_field only once * not required, but more efficient */ $who_specialises = get_field(‘who_specialises’); /* append to content on condition */ if ( in_array( ‘frazer-barton’, $who_specialises ) ) … Read more

How to add H4 tag to the_content filter (after content)?

Try this instead : //Related stock photo function function custom_content_after_post($content){ if (get_post_type( get_the_ID() ) == ‘portfolio’) { //Query for the the related posts – portfolio custom post type $loop = new WP_Query( array(‘post_type’ => ‘portfolio’, ‘posts_per_page’ => 5, ‘orderby’ => ‘rand’)); $sptitle=”<h4>Related Stock Photos</h4>”; while ( $loop->have_posts() ) { $loop->the_post(); $div = ‘<div style=”margin:25px 10px … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)