Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wysiwyg not saving paragraphs... #23

Closed
jezthomp opened this issue Dec 8, 2011 · 14 comments
Closed

wysiwyg not saving paragraphs... #23

jezthomp opened this issue Dec 8, 2011 · 14 comments

Comments

@jezthomp
Copy link

jezthomp commented Dec 8, 2011

A wysiwyg within a meta box although saying the text is in a p tag, its not actually once its printed front end.

Bold tags work, as do others but the initial P tag does not.

Kind of making having the wysiwyg there a bit pointless?

Anyone else have this issue or just me?

@franz-josef-kaiser
Copy link
Contributor

Afaik, no issue. I guess you simply haven't attached the proper filter. Just use

echo apply_filter( 'the_content', get_post_meta( get_the_ID(), etc. ) );

@rilwis
Copy link
Member

rilwis commented Dec 22, 2011

Hi @jezthomp , I've just tested the <p> tag and don't see the problems.

Here's my content in the textarea box:

I'm a WP developer and a freelancer from Vietnam. <b>This is strong</b> <i>Cool</i><p>This is a paragraph</p><p>Another paragraph</p>

And I just display it using:

<?php echo get_post_meta( get_the_ID(), '_bio', true ); ?>

@franz-josef-kaiser
Copy link
Contributor

Guess we can close that as localized/invalid.

@rilwis
Copy link
Member

rilwis commented Dec 23, 2011

OK, I close the issue now. @jezthomp if you still have this problem, please reopen the issue.

@rilwis rilwis closed this as completed Dec 23, 2011
@dwcouch
Copy link

dwcouch commented Mar 19, 2015

I'm seeing this too - If I add

to paragraphs while in [text] then save - the html comes through on the front end.

However when I re-open, the editor is still in [text] but the html has been converted to html hex. <p>
Viewing it in visual of course now shows my html of course.

It's as if [text] saves html, but when re-opened it converts any html to the respective HTML Entity Names. So saving it again just makes a mess.

@rilwis
Copy link
Member

rilwis commented Mar 23, 2015

Hi,

I've tested again with wysiwyg field type and don't see the problem (same as comments above). Here is how I input text (after save post, I see same result):

http://prntscr.com/6k74hn

And how it looks in the frontend:

http://prntscr.com/6k74lj

@dwcouch
Copy link

dwcouch commented Mar 23, 2015

The visual editor view:
screenshot 2015-03-22 23 17 59 - visual editor

The Text Editor view:
screenshot 2015-03-22 23 18 21 - text-editor

Front end and html:
screenshot 2015-03-22 23 19 29 - front-end and html

Edits via text to add p tags and a comment:
screenshot 2015-03-22 23 23 01 - add p tags via text

This is what it looks like after saving:
screenshot 2015-03-22 23 23 48 - saved p tags via text

This is how it renders:
screenshot 2015-03-22 23 25 18 - front-end and html

The visual editor now looks like html:
screenshot 2015-03-22 23 25 35 - visual editor

If I make new edits to the text editor like this and save;
screenshot 2015-03-22 23 28 12 - text editor

It shows up on the front end like this:
screenshot 2015-03-22 23 28 41 - front-end and html 2nd save

Oddly enough a quick workaround is to copy the html from the WYSIWYG editor
and paste it into the Text editor and then save.

On Sun, Mar 22, 2015 at 10:45 PM, Tran Ngoc Tuan Anh <
notifications@github.com> wrote:

Hi,

I've tested again with wysiwyg field type and don't see the problem (same
as comments above). Here is how I input text (after save post, I see same
result):

http://prntscr.com/6k74hn

And how it looks in the frontend:

http://prntscr.com/6k74lj


Reply to this email directly or view it on GitHub
#23 (comment).

@rilwis
Copy link
Member

rilwis commented Mar 23, 2015

Can you upload images again? Looks like Github doesn't import images from email.

@dwcouch
Copy link

dwcouch commented Mar 23, 2015

I edited the previous message. Sorry about that.

@dwcouch
Copy link

dwcouch commented Mar 23, 2015

@rilwis
Copy link
Member

rilwis commented Mar 23, 2015

Can you show me the code to register meta boxes?

@dwcouch
Copy link

dwcouch commented Mar 24, 2015

<?php
/**
 * Registering meta sections for taxonomies
 *
 * All the definitions of meta sections are listed below with comments, please read them carefully.
 * Note that each validation method of the Validation Class MUST return value.
 *
 * You also should read the changelog to know what has been changed
 *
 */

/********************* BEGIN DEFINITION OF META SECTIONS ***********************/
$prefix = 'badge_'; // doesn't seem to be globally supported.
global $badge_meta_sections;
$badge_meta_sections = array();

// first meta section
$badge_meta_sections[] = array(
    'title' => '',          // section title
    'taxonomies' => array('sr_expertise', 'sr_service'),            // list of taxonomies. Default is array('category', 'post_tag'). Optional
    'id' => 'first_section',                    // ID of each section, will be the option name
    'fields' => array(                          // list of meta fields

        // TEXT AREA
        array(
            'name' => 'Extended Description',
            'desc' => '<span class="description">Extended description.</span>',
            'id' => 'badge_verbose',
            'type' => 'wysiwyg',
            'std' => ''
        ),

        // RADIO BUTTONS
        array(
            'name'    => 'Select a hover color',
            'id'      => "badge_hover_color1",
            'type'    => 'radio',
            // Array of 'value' => 'Label' pairs for radio options.
            // Note: the 'value' is stored in meta field, not the 'Label'
            'options' => array(
                    '#1d2e5b' => '<span class="sr_Water     ">Water         </span><br>',
                    '#634379' => '<span class="purple       ">Purple        </span><br>',
                    '#445b6a' => '<span class="sr_Sea       ">Sea           </span><br>',
                    '#7895a4' => '<span class="sr_Wind      ">Wind          </span><br>',
                    '#5A6527' => '<span class="green        ">Green         </span><br>',
                    '#818154' => '<span class="sr_Moss      ">Moss          </span><br>',                   
                    '#8b6b29' => '<span class="sr_Nut_Brown">Nut Brown      </span><br>',
                    '#ba8747' => '<span class="sr_Grain     ">Grain         </span><br>',
                    '#FCC53F' => '<span class="yellow       ">Yellow        </span><br>',
                    '#e28025' => '<span class="sr_Golden    ">Golden        </span><br>',
                    '#ad1015' => '<span class="sr_Fire      ">Fire          </span><br>',
                    '#90352d' => '<span class="sr_Brick     ">Brick         </span><br>',
                    '#632d00' => '<span class="sr_Earth     ">Earth         </span><br>',
                    '#473f38' => '<span class="sr_Warm_Gray ">Warm Gray     </span><br>',
                    '#000000' => '<span class="sr_Black     ">Black         </span><br>'
            ),
        )
    )
);

/**
 * Register meta boxes
 *
 * @return void
 */
function YOUR_PREFIX_register_taxonomy_meta_boxes()
{
    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if ( !class_exists( 'RW_Taxonomy_Meta' ) )
        return;

    global $badge_meta_sections;
    foreach ( $badge_meta_sections as $meta_section )
    {
        new RW_Taxonomy_Meta( $meta_section );
    }
}
// Hook to 'admin_init' to make sure the class is loaded before
// (in case using the class in another plugin)
add_action( 'admin_init', 'YOUR_PREFIX_register_taxonomy_meta_boxes' );


/********************* END DEFINITION OF META SECTIONS ***********************/

/********************* BEGIN VALIDATION ***********************/

/**
 * Validation class
 * Define ALL validation methods inside this class
 * Use the names of these methods in the definition of meta boxes (key 'validate_func' of each field)
 */
class RW_Taxonomy_Meta_Validate {
    function check_name($text) {
        if ($text == 'Anh Tran') {
            return 'He is Rilwis';
        }
        return $text;
    }
}

/********************* END VALIDATION ***********************/
?>
'''

@rilwis
Copy link
Member

rilwis commented Mar 25, 2015

Oh, this is another plugin Taxonomy Meta. I will fix it later in this repo.

@dwcouch
Copy link

dwcouch commented Mar 26, 2015

Oh geez. Sorry Tran. I forgot these were separate.
I've got both installed inside a custom theme.

Shall I repost on the TM repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants