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

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 */ }


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

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


8

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


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; /** ...


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


6

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


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

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


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

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


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

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


4

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


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

After creating the specific CSS you need to format the page how you like, you could: Create a custom page template with the CSS and assign the template this page. Create a page-{slug}.php file with the CSS, where {slug} is the page slug for this page (most likely the filename should be page-voronoi-temperature-map.php). Create a page-{ID}.php file, where ...


3

applying the 'the_content' filter could work: <?php echo apply_filters('the_content', $comment->comment_content); ?>


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

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

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


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 ); ?>



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