I update the types plug-in from a free to use old version to a bought new version
Suddenly the plugIn adds a paragraph into the html syntax.
I added pictures to show (one shows the normal structure with two spans, the other one shows the paragraph version).
There was patch in earlier threads, but I cannot download it anymore.
My clients uses a custom theme, in which custom fields are used.
I will include one of the template php files at the bottom that call the custom field named short_text hidden link is one example where the custom field is called ( I attached a screenshot which shows where to look for the code its outputting)
Also, I added how the custom field was set up. Sorry, it is in German.
Does that work for you to understand my issue?
Thanks a lot!
Anika
<?php
get_header(); ?>
<div class="container">
<?php while ( have_posts() ) : the_post(); ?>
<header class="page-header <?php if(has_post_thumbnail()){ echo "image";} ?>">
<?php
if(has_post_thumbnail()){
$image = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'pagehead-img');
echo '<img src="'.$image[0].'" alt="'.get_the_title().'"/>';
} else {
?>
<h1 class="page-title"><?php the_title(); ?></h1>
<p><?php echo types_render_field( "short_text", array()); ?></p>
<?php } ?>
</header><!-- .page-header -->
<div class="row">
<div class="col-md-9">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if(has_post_thumbnail()){ ?>
<!--<h1 class="page-title"><?php the_title(); ?></h1>-->
<?php
}
get_template_part( 'content', 'single' );
?>
<?php //upbootwp_content_nav( 'nav-below' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
comments_template();
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
$args3 = array( 'connected_type' => 'posts_to_posts',
'connected_items' => get_queried_object(),
'nopaging' => true, 'posts_per_page' => 6 );
$loop3 = new WP_Query( $args3 );
if ( $loop3->have_posts() ) :
?>
<div class="related-area">
<h3>Das könnte Sie interessieren!</h3>
<div class="row">
<?php while ( $loop3->have_posts() ) : $loop3->the_post(); ?>
<div class="col-md-4 col-sm-6 shortteaser">
<em><u>hidden link</u></em>
</div>
<?php endwhile;
wp_reset_postdata();
?>
</div>
</div><!-- related -->
<?php endif; ?>
</div><!-- .col-md-9 -->
<div class="col-md-3">
<?php get_sidebar(); ?>
</div><!-- .col-md-3 -->
</div><!-- .row -->
<?php endwhile; // end of the loop. ?>
</div><!-- .container -->
<?php get_footer(); ?>
From looking into the page's source code, I noticed that the text from the multi-line type custom field includes the starting paragraph tag but not the closing one. That is happening because the field's output is being trimmed down using the "substr" function.
alright, I tested it and it works. But I don't understand how suddenly this happens and when I have to go through and fix every php WordPress file (because there are many) this isn't a real fix for the issue.
Any ideas how to fix it for the complete site?
Thanks!
Anika
You'll find code online ( ref: hidden link ), to disable the automatic paragraphs insertion globally, but, I personally do not recommend this solution. This can also remove the paragraphs where you may need/expect them.
The change in the code that I shared in my last message, will only affect the targeted locations, though it would mean making the change in each template file where you've used a similar code.
thanks you. I resolved it with by adding it to the locations.
I wanted to let you know however, when this issue appeared the first time, when I replace the very old types version (version number 1. something) with the current, bought, version.
Wordpress ist up to date as well as the servers php version.