Tag Info

Hot answers tagged

36

Welcome to WordPress stack exchange! Just yesterday I created WP-Markdown, which enables Markdown on your posts. It also provides the same interface as this website (the toolbar, and live preview) - however, currently only for comments and bbPress forums (if enabled). That said, (since it would be straightforward to do), I am planning on adding an option ...


24

here's what we did yesterday on a client site that we were having this exact problem with... I created a quick filter as a plugin and activated it. <?php /* Plugin Name: Image P tag remover Description: Plugin to remove p tags from around images in content outputting, after WP autop filter has added them. (oh the irony) Version: 1.0 Author: Fublo Ltd ...


11

If you pass nothing for the supports argument, the default settings of 'title', 'editor' is used (where "nothing" is anything that is empty()). However, just like you can add support for something after registering the post type with add_post_type_support( $post_type, $feature ), you can remove support for something by calling remove_post_type_support( ...


11

I recently got this working. You should search and replace metaname with your meta box name. The key to maintaining formatting was using wpautop(); when saving the data. add_action( 'add_meta_boxes', 'add_metaname_box'); add_action( 'save_post', 'metaname_save'); function add_metaname_box() { add_meta_box( 'metaname_id', __( 'metaname ...


10

Basically you need to make WordPress treat img like block-level element for the purpose of formatting. Such elements are hardcoded in wpautop() and list is unfortunately not filtered. What I would do is: Fork wpautop() under different name. Add img to regexp in $allblocks variable. Remove wpautop from the_content filter. Add your forked version to ...


10

Hazarding a guess at what you really mean, I suppose you mean something like this is happening: If that is what you're referring to, that's because your theme has an editor-style.css stylesheet that's getting used in the visual editor. Somewhere inside that stylesheet is something like this: html .mceContentBody { max-width:640px; } Removing that ...


9

If you end goal is to add text boxes dynamically, but still require the user to save/update the post, you don't need to use AJAX at all. Just name the text fields appropriately so an array of values is POSTed, then handle it in your save action. It may be helpful to save this array in a single post meta key, so you can just loop through it to output the ...


8

You have a couple of options. First, you can always click on the bottom right corner of the post edit box and drag to resize: However, you can also make it so that the post box is larger by default. Go to Settings > Writing, and change the value for size of the post box:


8

I created two plugins that together should solve my needs. They are currently in an early alpha stage, and all comments are welcome. The base plugin is an On-Demand Resizer. This plugins monitors requests for non-existing files in the uploads dir, and creates images of the requested size if needed. For example, image-200x100.jpg will create and return ...


8

Giving a blank array to 'supports' in the declaration of the post type should get rid of the editor and the title, along with every other default box in the edit post page. $supports = array (''); $args = array( 'label' => 'people', 'supports' => $supports, 'hierarchical' => false, 'public' => true, 'rewrite' ...


8

Hi @José Pablo Orozco Marín: If you are looking for how to code the custom buttons yourself, WordPress' Codex has a great example that shows you how: http://codex.wordpress.org/TinyMCE_Custom_Buttons The example is complicated because it shows you how to add your own controls but if you are using the standard buttons you don't need to make is to ...


8

You don't want to edit core WordPress code. You don't need to edit core WordPress code to do what you need to implement. First, you need to study the WordPress templating (i.e. Theme) functionality. Then, you need to study Plugins and the WordPress Hooks API, including its Action Hooks and its Filter Hooks. To do what you're describing, you definitely ...


8

If it's getting too hard and complicated, you can simply add new buttons by using jQuery. Simply clone an existing or create a new button, and append it to the editor's toolbar. You can wrap the javascript with a php function, and run it in the admin footer or something. Or you can use the edButton function. Here is a dirty and fast written example for ...


7

There are a few functions that come in handy here: unstick_post - Unstick a post stick_post - Stick a post is_sticky - Figure out if a post is sticky With those three in mind, all we need to do is stick them together with some admin menu bar glue. First off, let's wrap everything in a class for fun and profit. This class will have some constants that ...


7

First of all, make sure you try things out in a development environment on your own PC. This way you can try things out without breaking your live site. The XAMPP package contains everything you need to run it on your own Windows, Mac, Linux or Solaris machine. Then, enable debugging mode by setting WP_DEBUG to true in your wp-config.php. You need this to ...


7

There's an easy way. Open functions.php and add this code. It works for many html entities // got this form http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor function enable_more_buttons($buttons) { $buttons[] = 'hr'; /* Repeat with any other buttons you want to add, e.g. $buttons[] = 'fontselect'; $buttons[] = 'sup'; */ ...


6

This should be what you're looking for - put this code into your theme's functions.php file: add_filter( 'tiny_mce_before_init', 'yourprefix_tiny_mce_before_init' ); function yourprefix_tiny_mce_before_init( $init_array ) { // filter styles: $init_array['theme_advanced_styles'] = "your_style=your_class"; // filter formats: ...


6

It really depends on what you're trying to do. First of all, you should never edit core WordPress files. Any changes you make will be lost if and when you upgrade, so if you want to change functionality, use a plug-in. If you want to change the way your site displays, change the theme. In either case, you don't want to work on a live site ... things can ...


6

Thanks for the hint Bainternet, indeed this is very easy to implement with jQuery. Example (the four meta boxes are closed for clarity) : Here's what I did : var $j = jQuery.noConflict(); $j(document).ready(function() { $j("#side-sortables").append('<div id="container_div" class="postbox meta-box-sortables ui-sortable"><div ...


6

The second parameter for tb_show is the URL, so you'll want to use something like.. <?php $ajax_url = add_query_arg( array( 'action' => 'getTheContent', 'query_var1' => 'value1', 'query_var2' => 'value2' ), admin_url( 'admin-ajax.php' ) ); ?> tb_show(tag, <?php echo $ajax_url; ?> ); I'd ...


6

There is not a way to do this without modifying the core. You should see .php files that are in subdirectories, but you won't see anything above the root theme directory for .css files, and you won't see any JavaScript files. If you take a look at wp-admin/theme-editor.php, the relevant lines are... <?php $allowed_files = $theme->get_files( 'php', ...


6

The answer suggested by GavinR is correct. You don't need to install the suggested plug-in, though. Just add this mini plugin and you're set: <?php defined( 'ABSPATH' ) OR exit; /* Plugin Name: TinyMCE break instead of paragraph */ function mytheme_tinymce_settings( $tinymce_init_settings ) { $tinymce_init_settings['forced_root_block'] = false; ...


5

The best way would be using JavaScript to inject the element. Here's the gist of the markup for that page: <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div id="titlediv"> ... other stuff ... </div> ...


5

There is a hook for that: 'mce_css'. It is called in _WP_Editors::editor_settings() and you get all loaded stylesheets comma separated as the first and only parameter. Now it is easy: Use the global variable $editor_styles (here are your theme’s and parent theme’s editor stylesheets stored already), add the time of the file’s last modification as a ...


5

This will allow the post editor to be moved like the other sortable post boxes. function move_posteditor( $hook ) { if ( $hook == 'post.php' OR $hook == 'post-new.php' ) { wp_enqueue_script( 'jquery' ); add_action('admin_print_footer_scripts', 'move_posteditor_scripts'); } } add_action( 'admin_enqueue_scripts', 'move_posteditor', ...


5

The best way to do this is by adding 'user_can_richedit' filter, like so: add_filter( 'user_can_richedit', 'patrick_user_can_richedit'); function patrick_user_can_richedit($c) { global $post_type; if ('page' == $post_type) return false; return $c; } Hope it's useful ;)


5

However, I am unsure how to get full access to the Source Code of the site. You will need FTP/SFTP access to for decent development experience. I have privileged access to the backend of the site but in wordpress when you go to edit it only shows some of the basic html tags while hiding the and tags and code. Is there any way edit the page in its ...


5

I'd suggest using editor style for your wysiwyg. Add add_editor_style(); to your functions.php and then add a new file called editor-style.css to your main theme directory. Your editor style should reflect the basic css settings like your actual frontend content width, H1, H2, p etc tags styles, margins, image padding adn margins etc. Don't copy your default ...


5

I use Advanced Custom Fields for lots of front end post editing with meta boxes. ACF allows you to build lots of advanced meta box fields and adds them automatically to the back end post panel. But there is a front end function as well. This method is completely free. The only way it costs anything is if you want to use any of their more complex field type ...


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



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