WordPress.org

Ready to get started?Download WordPress

Forums

Text-align doesnt work in my column shortcode (7 posts)

  1. Miro4994
    Member
    Posted 11 months ago #

    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.

  2. Reginald
    Member
    Posted 11 months ago #

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

  3. Miro4994
    Member
    Posted 11 months ago #

    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>

  4. alchymyth
    The Sweeper & Moderator
    Posted 11 months ago #

    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?

  5. Miro4994
    Member
    Posted 11 months ago #

    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);
    })();
  6. Reginald
    Member
    Posted 11 months ago #

    Hmm...

    tinymce.PluginManager.add('one_third', tinymce.plugins.one_third);

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

  7. Miro4994
    Member
    Posted 11 months ago #

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

Reply

You must log in to post.

About this Topic