Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.59k stars 798 forks source link

[markdown] html short code remove markdown formating 2 #1624

Open gregoirenoyelle opened 9 years ago

gregoirenoyelle commented 9 years ago

Hello @jeherve

I get the same bug please see #1151 . This time I really have wpcom-markdown with this post type and the shortcode (custom made this time) only display the content of an other post type (please see the code bellow).

Content in the WordPress Editor of the custom post type at the beginning

### Sommaire

[plan-module post_id="5719"]

[plan-module post_id="5724"]

[plan-module post_id="5726"]

### Ressources

Toutes les ressources liées au module.

#### Liste de plugins utilisés durant le WordPress 1

* [Admin Menu Reorder](https://wordpress.org/plugins/admin-menu-reorder/ "Ouverture"): Pour réorganiser ses menus dans l'admin.
* [BackWPUp](https://wordpress.org/plugins/backwpup/): pour les sauvegardes
* [Black Studio TinyMCE Widget](https://wordpress.org/plugins/black-studio-tinymce-widget/ "Ouverture"): Widget avec un éditeur visuel de type page ajouté
* [Easy FancyBox](https://wordpress.org/plugins/easy-fancybox/): Pour ajouter des effets lightbox sur les images.
* [Jetpack par WordPress.com](https://wordpress.org/plugins/jetpack/ "Ouverture"): Ensemble de plugins incontournables (partage, formulaire, effets de galerie...)
* [Meta Slider](https://wordpress.org/plugins/ml-slider/ "Ouverture"): Pour ajouter des widgets personnalisés

Content in the WordPress Editor of the custom post type after a while

<h3>Sommaire</h3>

[plan-module post_id="5719"]

[plan-module post_id="5724"]

[plan-module post_id="5726"]

<h3>Ressources</h3>

Toutes les ressources liées au module.

<h4>Liste de plugins utilisés durant le WordPress 1</h4>

<ul>
<li><a href="https://wordpress.org/plugins/admin-menu-reorder/" title="Ouverture">Admin Menu Reorder</a>: Pour réorganiser ses menus dans l'admin.</li>
<li><a href="https://wordpress.org/plugins/backwpup/">BackWPUp</a>: pour les sauvegardes</li>
<li><a href="https://wordpress.org/plugins/black-studio-tinymce-widget/" title="Ouverture">Black Studio TinyMCE Widget</a>: Widget avec un éditeur visuel de type page ajouté</li>
<li><a href="https://wordpress.org/plugins/easy-fancybox/">Easy FancyBox</a>: Pour ajouter des effets lightbox sur les images.</li>
<li><a href="https://wordpress.org/plugins/jetpack/" title="Ouverture">Jetpack par WordPress.com</a>: Ensemble de plugins incontournables (partage, formulaire, effets de galerie...)</li>
<li><a href="https://wordpress.org/plugins/ml-slider/" title="Ouverture">Meta Slider</a>: Pour ajouter des widgets personnalisés</li>
</ul>

Code for the shortcode used at the beginning

/**
 * Short code plan module
 *
 * Pour affichier les plan de module en y insérant le shortcode suivant
 * [plan-module post_id="$id"]
 * @since 1.0
 * @author Grégoire Noyelle <hello@gregoirenoyelle.com>
 */

add_shortcode( 'plan-module', 'gncom_plan_shortcode' );
function gncom_plan_shortcode( $atts ) {

    // Pull in shortcode attributes and set defaults
    $atts = shortcode_atts( array(
        'post_id' => false
    ), $atts, 'plan-module' );

    // attribut ID
    $post_id = $atts['post_id']; // Sanitized later as an array of integer

    // Set up initial query for post
    $args = array(
        'post_type' => 'gnpost_planmod',
        'post__in' => array( $post_id ),
    );

    // Query
    $plan = new WP_Query( $args );

    while ( $plan->have_posts() ): $plan->the_post(); global $post;

        $content = '';

            /** This filter is documented in wp-includes/post-template.php */
            $content .= '<div class="plan-module">' . get_the_content() . '</div>';

    endwhile; wp_reset_postdata();

    return $content;
}

Thanks

gregoirenoyelle commented 9 years ago

Hello @jeherve Any idea? Thanks

jeherve commented 9 years ago

I'm not sure I understand. There isn't any markdown in your example above.

gregoirenoyelle commented 9 years ago

@jeherve Sorry about that, I've updated the first message. I think, when you use shortcode (see first message) which display some content from somewhere else it cause some bugs sometimes. Not always.

jeherve commented 9 years ago

What happens when you use an enclosing shortcode instead of the self-enclosing one? (ref)

gregoirenoyelle commented 9 years ago

But I don't need to put content between the two shortcode (open and close). Is it more stable?

jeherve commented 9 years ago

Is it more stable?

It's not more stable, but it would just help us narrow down the problem to a specific set of shortcodes.

gregoirenoyelle commented 9 years ago

Ok. Thanks. I will try. The problem is that the bug occurs only from time to time.

gregoirenoyelle commented 9 years ago

I get the same bug this morning on a normal page without shortcode in it. Just links. All the markdown disappear and I just have html instead. In my settings, the visual editor is disable.

stale[bot] commented 6 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

github-actions[bot] commented 3 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.