WordPress excerpt with formatting and allowing selected tags
Use strip_tags() to strip all tags. Pass tags you want to allow as second argument. For you reference http://in2.php.net/strip_tags
Use strip_tags() to strip all tags. Pass tags you want to allow as second argument. For you reference http://in2.php.net/strip_tags
If it can be explicetly defined as the_title, then this should work for you: $pages = get_pages(array (‘sort_column’ => ‘menu_order’)); foreach ($pages as $page_data) { $fields = get_fields($page_data); if( $fields ) { echo ‘<div class=”the_title”>’ .$fields[‘the_title’] . ‘</div>’; echo ‘<div class=”container”>’; foreach( $fields as $field_name => $value ) { $field = get_field_object($field_name, false, array(‘load_value’ => … Read more
How to prevent wordpress from autoformatting my posts once and for all?
Check if any of these you have in your theme’s functions.php file. remove_filter( ‘the_content’, ‘wpautop’ ); remove_filter( ‘the_content’, ‘wptexturize’ ); remove those.
(obviously) untested, and make a backup of your DB first…but you ought to be able to do this natively in SQL: UPDATE wp_posts SET post_content = REPLACE(post_content, ‘<p>’, ”) WHERE (put whatever selection logic you want here…) Do the same for </p>. Like I said…make a backup first… (edit) geez, didn’t realize this was a … Read more
echo wp_editor to screen with formatting
Just create a template and assign this template the page you are creating in admin. Now in template get all content using page id. That’s it.
Ah ha: by searching the rendered page for target I discovered that the site was running a plugin called “Open external links in a new window.” Disabling that plugin solved the problem.
The theme’s style sheet uses the reset method to set all margins on the <p> tag (and many others) to 0 (this is common practice). So you would need to add a style declaration into your style sheet to add the top and bottom margin back in for the <p> tag. For example: you could … Read more
A quick solution would be to change this: //rename the array keys foreach( $data as &$new_values ) { $new_values[‘user_id’] = $new_values[0]; unset( $new_values[0] ); $new_values[‘product_id’] = $new_values[1]; unset( $new_values[1] ); } Into this: //rename the array keys foreach( $data as &$new_values ) { $new_values[‘user_id’] = (string) $new_values[0]; unset( $new_values[0] ); $new_values[‘product_id’] = (string) $new_values[1]; unset( … Read more