Tag Info

Hot answers tagged

4

The answer by bungeshea is not ideal as in many cases: You don't want to strip everything from <br>, <p> etc. You want it as a default behavior for your WP visual composer which the above code will delete In many cases it is considered as "hacking the core" as this is changing the default core behavior of WP - for example such a thing will not ...


3

Try removing (image), like this: <?php $content = get_the_content(); $content = preg_replace("/<img[^>]+\>/i", " ", $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?>


2

The wpautop() function adds <p> and <br> tags to your content in order to preserve line breaks. If you would rather add these tags yourself, then you can remove the filters which apply this function to the post content: remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); If you would like to keep the automatic ...


1

this string is displayed when you get a nonce mismatch, something that should not happen much under normal usage. If it does haen enough to make you aware to it then you should investigate the cause. Anyway, no easy filter for that string so you will have to use the translation api to replace it. add_filter ( 'gettext', 'wpse_120304', 10, 3 ); function ...


1

Do you mean you want the Post content to be used as a placeholder text in a forms text box? I guess you could do something like this if that is what you are trying to do.. <?php $content = the_content(); ?> <form action="demo_form.php"> <input type="text" name="postvalue" placeholder="<?php echo $content ?>"> <input ...


1

I just slightly modified @Bainternet's answer. Using a switch on post_type, it's even possible to redirect to different templates. The default will let wordpress ignore the my_print parameter and go on as usual. add_action("template_redirect", 'my_template_redirect_2322'); // Template selection function my_template_redirect_2322() { global $wp; ...


1

Looking through the docs reveals that you can either disable that slider all together, or add your own slides in it which will replace the default text that you see now. To add your own slides, use the instructions here: http://siteorigin.com/pitch-documentation/content/home-page-slider/ To disable the slider you should probably hunt for the option. I'm ...


1

If you really want to execute code stored in a database, a quick google search reveals that you can use the eval() function to do just that. However, many people do say that Eval is Evil... Instead of storing the entire PHP code of an option in the database, try storing a simple boolean flag for your option and then test whether to get your template's ...


1

This seems to do it: function allow_nbsp_in_tinymce( $mceInit ) { $mceInit['entities'] = '160,nbsp,38,amp,60,lt,62,gt'; $mceInit['entity_encoding'] = 'named'; return $mceInit; } add_filter( 'tiny_mce_before_init', 'allow_nbsp_in_tinymce' ); Any improvement suggestions?



Only top voted, non community-wiki answers of a minimum length are eligible