Syntax Highlighter XML striping
Your best bet is to use custom post meta to store the code, and output it however you want. In other words, skirt the editor entirely. Here’s a really clever WP theme by Dan Cederholm that does this like a champ.
Your best bet is to use custom post meta to store the code, and output it however you want. In other words, skirt the editor entirely. Here’s a really clever WP theme by Dan Cederholm that does this like a champ.
The problem is that $content is a reserved variable in WordPress, you have to use another name. Here, I have used $pre_content: <?php /** * Plugin Name: T5 Editor content by request * Description: Default text for post content from GET variable <code>pre_content</code>. * Author: Fuxia Scholz * Version: 2012.06.30 */ /* * See wp-admin/includes/post.php … Read more
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 that to PHP. PHP Tidy, if … Read more
I found a nice snippet at this site for your functions.php that does the trick: add_shortcode( ‘gallery’, ‘file_gallery_shortcode’ ); function file_gallery_shortcode( $atts ) { $atts[‘link’] = ‘file’; return gallery_shortcode( $atts ); } I’d actually been looking unsuccessfully for the same thing, so I’m glad you asked.
“You should not write to the DB on front end requests” is the eleventh commandment. Your performance will deteriorate due to the writes locking down the table much more than the impact the size of the table will have. You should probably write such data in files instead of DB, or at least use a … Read more
Well, I’m afraid it won’t work this way. Let me explain why… In your wpzen_change_post_order function you check if $query->is_main_query(). To be precise, this checks, if given query is main query for current page – the query generated by WP to display default posts for current page. So if you create your own WP_Query object, … Read more
What I could gather from your question is: You want to ignore one category (may be more) in the related post query. However, you don’t want to actually exclude the posts from that category (in case any post belongs to that category, but also belongs to another category you want to look for). Based on … Read more
You’re absolutely right in your assumption. CSS should never be tied to post IDs, because they can always change (for example if you decide to migrate your posts to another install). You can always shift control towards the admin dashboard. Add a custom field in a post/page that you want styled in a special way … Read more
Your current function works pretty well, but it’s hooked on to a post update hook so you need to actually edit/update a post for it to run. If you want the posts to be modified automatically after the specified time then you’ll need to set up a scheduled event. I can think of two ways … Read more
Here’s one way to check if there was an DB error within get_posts(): global $EZSQL_ERROR; $before = isset( $EZSQL_ERROR ) ? count( $EZSQL_ERROR ) : 0; $posts = get_posts( $args ); $after = isset( $EZSQL_ERROR ) ? count( $EZSQL_ERROR ) : 0; if ( empty( $posts ) && $before < $after ) { // … … Read more