Tag Info

Hot answers tagged

15

The "classic" TinyMCE editor has two dropdowns: formatselect for paragraph styles and styleselect for character styles - which can also contain paragraph styles, to make it more confusing. The configuration in WordPress by default only shows the format dropdown. If you apply a custom stylesheet to the editor, TinyMCE can use it to pick up the classnames and ...


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 ...


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 ...


7

I'm using something like this: date('F, Y', strtotime($data[0]->post_date));


7

wordpress.com supports code syntax-highliting. You can read all about it here: http://en.support.wordpress.com/code/posting-source-code/ for your specific example use: [sourcecode language="java"] package com.jameselsey.domain; import java.util.ArrayList; import java.util.List; import com.google.android.maps.GeoPoint; import android.app.Application; /** ...


6

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, ...


6

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){ ...


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

Yes you can. It's [code] *your code here* [/code] and you can even hint the language: [code lang="php"]<?php echo 'test'; ?>[/code]. This is the method I prefer (quick to write). There seem to be other ways as the following resource explains: Support: Code » Posting Source Code (wordpress.com)


5

If you look at the page source, you'll see that <body> has been given a class page-id-1199. You can use that in your stylesheet to specify styles for that page alone. .page-id-1199 #map { /* custom styles */ }


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

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"; ...


5

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" ...


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

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

After you post your content, WordPress will pass the_content() function through a number of filtering function's. There are four of them, wptexturize(), convert_smilies(), convert_chars(), and wpautop(). All of these are defined in wp-includes/formatting.php and are referenced in wp-includes/default-filters.php. To remove these filtering functions you can ...


4

There is a clue in wp-includes/formatting.php in the function wptexturize: $default_no_texturize_shortcodes = array('code'); ... $no_texturize_shortcodes = '(' . implode('|', apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')'; Try using this filter to add a shortcode to the array: function my_no_tex( $shortcodes ) { ...


4

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, ...


3

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().


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

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


3

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


3

The plugin TinyMCE Excerpt adds the Visual Editor to the Excerpt field. http://wordpress.org/extend/plugins/tinymce-excerpt/


3

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 ...


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 ...


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

There are no hooks in wpautop(), at all. Given that this is possibly the most complained about function in the WordPress world, it is odd that there are none but there you go. What you will need to do is remove the filter: remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); Create a version that does what you want, and ...


3

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 }


2

br and p tags get stripped out and converted to newlines, they're not added until the post content is output. See the codex entry for the wpautop function, this is what is converting those newlines to br and p tags on the_content. It's difficult to say what exactly is going here in this case though. I find it easier to stay in visual mode and shift-return ...


2

Get all of your posts in one query, then count the iterations of your loop. Pseudo-code follows. if ( $query->have_posts() ) { $i = 0; while ( $query->have_posts() ) { // If $i is 5 (5th post), end one row and start the next if (++$i == 5) { echo '</tr><tr>'; } // the rest of your loop output



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