12

I created a Kint plugin that works really well. I also integrates with the Debug Bar plugin. You can download it at: http://wordpress.org/extend/plugins/kint-debugger/ There are a few functions to help you out with WordPress specific globals: dump_wp_query() dump_wp() dump_post() For printing arrays in a styled, collapsible format you would do the ...


12

This is an older question, but here's the answer for future generations: WordPress will check the styles against a whitelist and it will still strip the style attribute if none of the styles are safe. The default whitelist is: text-align margin color float border background background-color border-bottom border-bottom-color border-bottom-style border-...


10

There actually are several ways to handle the Wordpress editor wrapping shortcodes in <p> tags. This code shows probably the simplest way to do it...just a simple and short function you need to drop into your functions.php file. Once you do, no more tags around your shortcodes that are on their own line! function wpex_clean_shortcodes($content){ $...


10

The default content type is 'text/plain' which does not allow using HTML. You can set the content type of the email by including a header like "Content-type: text/html" $headers = 'Content-type: text/html;charset=utf-8' . "\r\n"; $headers .= 'From: XXXXXX.com <info@xxxxx.com>' . "\r\n"; $subject = 'Registration from xxxxx.com' . "\r\n"; $...


8

I ran into this problem a year or so ago, and found a fix here. Open PHP.INI in a text editor of your choice (normally you can find php.ini in your php install dir) Change the recursion limit to 200x normal, that is, set: pcre.recursion_limit=20000000 Change the backtrack limit to 100x normal, that is, set: pcre.backtrack_limit=10000000 Stop and start the ...


8

Wordpress automatically ads the <p> tags to the content. So it shows up while loading the content. This is with the filter wpautop. So we will remove this filter for the image post type only. You can manage this by adding the following code in functions.php file. // Add the filter to manage the p tags add_filter( 'the_content', '...


7

You can install and use Krumo with WordPress (or any PHP app really). There's the Hikari Krumo plugin that simplifies use, though check the comments there, there's an error that you'll need to manually fix to get it working with latest WP. There's also the WordPress Debug Bar plugin which you might find useful. EDIT- Another option I've recently discovered, ...


7

If this is how it looks: <img class="alignleft size-medium wp-image-8530" alt="..." src="#" width="413" height="275" /> <img class="alignleft size-medium wp-image-8529" alt="..." src="#" width="413" height="275" /> Then you have to put them together like this: <img class="alignleft size-medium wp-image-8530" alt="..." src="#" width="413" ...


6

I know exactly how you feel, and sadly this problem is rooted in the wordpress core code not in TinyMCE or due to browser compatility problems. I wrote a plugin that allows you to format html markup in the HTML editor, switch back and forth between it and the Visual tab without affecting the source code, and make changes in the Visual tab without breaking ...


6

In your functions.php: remove_filter( 'the_content', 'wptexturize' ); And the same for the_excerpt or the_title (if required).


6

You can use sanitize_title() function: $string = "This is title string"; // return "this-is-title-string" $slug = sanitize_title( $string ); You can also filter the result of sanitize_title() function using sanitize_title filter: add_filter( 'sanitize_title' , 'sanitize_filter_callback', 10, 3 ); function sanitize_filter_callback( $title, $raw_title, $...


5

For this kind of stuff, I wrote REF (requires PHP 5.3). Among many other features, it displays contents of DocBlock comments and linkifies PHP-internal classes, methods and functions (links point to the PHP manual). It also handles WordPress functions (links point to queryposts.com). Here's the output of $GLOBALS at the setup stage of WordPress in HTML mode ...


5

This is one of the reasons why HTML markup is removed from excerpts in the first place, to prevent such issues like this from occurring however, where there's a will, there's a way... You can, through using regular expression, close the open tags applicable to the excerpt only and you might want to take a look at the following link for some ideas, Close ...


5

I’ve done something similar taking the simple approach of adding a CSS class to titles based on their character count. That CSS class then decreases letter-spacing and/or font-size. // Count the characters, taking Unicode into account $chars = mb_strlen($post->post_title); // For every 10 characters after the first 20, add a size $size = max(0, ceil(($...


5

The excerpt is created in -> wp-includes/formatting.php with this code: function wp_trim_excerpt($text) { // Fakes an excerpt if needed global $post; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace('\]\]\>', ']]&gt;', $text); $text = strip_tags($...


5

Alright so I've already updated this question a ton and it's starting to get overloaded, so I figured I'd write this as an answer even though it isn't a full one. Extrapolating from @bueltge's answer, I actually went back and found his previous post in question. In that post, there was a plugin listed that I've never seen before: "Preserved HTML Editor ...


4

To format number, you can use the function number_format_i18n (it's not documented now, but you can see its source here). Its work is format the number based on the language. You might want to look at number_format (PHP built_in function, and is used by number_format_i18n) to have more control to decimal point and thousand separator. In your case, this code ...


4

Use number_format_i18n( $number ). It will format the number with respect to the current blog’s language setting. It is a wrapper for PHP’s native number_format().


4

I think your question is a perfect example for the XY Problem. In WordPress you do not create such a menu in a post editor. You use a menu. Once you start thinking about your problem from this point, everything is easy. :) First register a custom navigation menu for this list in your theme’s functions.php: add_action( 'wp_loaded', '...


4

If this post type is called "image", you can create a single template to handle the display of just the image post type. Just copy your 'single.php' file and rename the copy 'single-image.php'. Now you can control just the image posts. To strip out tags, I like to use the strip_tags() function. If you print the content of the post with the_content() it ...


4

The problem is that the_sub_field() echoes the Subfield, so in your conditional the field company_name gets echoed. However, this function does not return true, so the conditional is not met. You need to use another if statement: if ( get_sub_field('company_name') && get_sub_field('company_name') != '' ) { // echo it }


4

The quick fix is to wrap your image tags in div tags. That will prevent WP from wrapping the images in P tags. Then, you could give the divs a class for further control of appearance/arrangement.


4

You need to use wp_title(); If you're trying to use the post title like so: <head> <title> post title here </title> </head> You would need to add the wp_title(' ', true , ' '); <head> <title> <?php wp_title('', true,''); ?> </title> </head> For example: If your post name was Hello World, Hello ...


3

This may sound stupid but why not just add the space in your function? There are several places to do it: 'nextpagelink' => __(' Next') $args['link_before'] . ' ' . $args['nextpagelink'] . $args['link_after'] . '</a>'


3

The wp_title() template tag does some context-based output. From the Codex: The title text depends on the query: Single post or a Page the title of the post (or Page) Date-based archive the date (e.g., "2006", "2006 - January") Category the name of the category Author page the public name of ...


3

Use get_post_class() when you want the values to be returned rather than echod.


3

Try accessing the $post object inside your loop, and echo'ing the content from that. Something like: <?php echo $post->post_content ?> Edit If you need to parse shortcodes, use do_shortcode(): <?php echo do_shortcode( $post->post_content ); ?>


3

function myshortcode( $atts, $content = null ) { return strip_tags($content,'br'); } add_shortcode('myshortcode','myshortcode'); But I am unclear why you are you adding newlines in the first place if you don't want them.


3

I am interpreting the question to mean that you already have Word markup in your post and so you need to clean that up via PHP. If so... You can see the code that cleans up Word content here: http://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js#L375 That is Javascript. With some work, you could convert ...


3

At first, I think this problem was solved since WP version 3.5; see ticket 19666 in trac. But the tinyMCE have a hook there give us the chance to change the content inside the editor and you must not parse on output on frontend. A small source script. I have no test this with a current WP version, was a older solution for a customer. Add this source via ...


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