Support » Fixing WordPress » Text-align doesnt work in my column shortcode

  • Good morning, im building my first website on a wordpress and i dont know what im doing wrong, but when im in the post editor and i will set text-align for a text in the column shortcode it works well, but when i view the page it doesnt work and the text-align paragraph is before my shortcode´s <div> element.

    Could you please help me? I dont know what Im doing wrong…
    And sorry for not so good english.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hmm…

    Have you try this? <p style=”text-align: center;”>Test Word</p>

    When you click center using the button, you should see the above code.

    Does this solve your issue?

    Sorry if I can’t help much >.<

    The code works, but not for my shortcodes…

    When i´ll press for example text-align center button for a simple text and my shortcode it will not works… It will looks like this:

    In editor:

    <p style=”text-align: center;”>Text without shortcode
    [one_third]Column Shortcode[/one_third]</p>

    On page:

    <p style=”text-align: center;”>Text without shortcode</p>
    <div class=”one_third”>Column Shortcode</div>

    Michael

    (@alchymyth)

    Forum Moderator

    you will possibly need to repeat the text-align stuff within the shortcode;

    example:

    <p style="text-align: center;">Text without shortcode</p>
    [one_third]<p style="text-align: center;">Column Shortcode</p>[/one_third]

    or use css (added to style.css of your theme) to align the texts.

    what plugin are you using for the column shortcode?
    or is it part of your theme? which theme?

    It doesnt work even if i repeat the text align within the shortcode.

    I´m not using a plugin, its my own column shortcode but im 100% sure that its was coded well.

    add_shortcode('one_third', 'one_third');
      function one_third($atts, $content = null ) {
        return '<div class="one_third">'.do_shortcode($content).' </div>';
    }
    (function() {
        tinymce.create('tinymce.plugins.one_third', {
            init : function(ed, url) {
                ed.addButton('one_third', {
                    title : 'Column 1/3',
                    image : url+'/MCE-icons/ico_1-3.png',
                    onclick : function() {
                         ed.selection.setContent('[one_third]...[/one_third]');
                    }
                });
            },
            createControl : function(n, cm) {
                return null;
            },
        });
        tinymce.PluginManager.add('one_third', tinymce.plugins.one_third);
    })();

    Hmm…

    tinymce.PluginManager.add(‘one_third’, tinymce.plugins.one_third);

    Did you have plugin before? The above line….maybe!

    Nope i didnt. However it works well, the shortcode is working but text-align inside the shortcode isn´t working.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Text-align doesnt work in my column shortcode’ is closed to new replies.