Skip to content

The code looks bad after formatting #173

@kanlukasz

Description

@kanlukasz

Description:

If we have a bit more code, the code looks bad after formatting.
Maybe it's related with #171

Disclaimer:

My example is the custom Wordpress template - I know that the code style in Wordpress is the worst horror possible and it's hard to keep it with some systematic logic. However, the formatting with bmewburn add-on is correct. (you can check how it works there)

Video gif screen below:

Animation2222

Code snippet for tests:

<section class="container text-center component-team-slider mt-5 mt-md-7 mb-7">
    <h2 class="mt-6 mb-5 mb-md-7 component-team-slider__spec-display">
        <?php echo in_category(11) ? 'Poznan' : 'Nie'; ?>
    </h2>
    <?php
    $post_id = 214;
    $post_object = get_post($post_id);
    echo $post_object->post_content;
    ?>
</section>

<div id="card-slider" class="splide mx-2 mx-md-5 mx-lg-9 component-team-slider">
    <div class="splide__arrows">
        <button class="splide__arrow splide__arrow--prev"></button>
        <button class="splide__arrow splide__arrow--next"></button>
    </div>
    <div class="container">
        <div class="splide__track">
            <ul class="splide__list">
                <?php
                $query_team_slider = new WP_Query(array(
                    'cat' => 11,
                    'meta_key'     => 'post_zespol_prior',
                    'orderby'      => 'meta_value',
                    'order'        => 'DESC',
                    'post__not_in' => array($post->ID)
                ));
                ?>
                <?php if ($query_team_slider->have_posts()) : ?>
                    <?php while ($query_team_slider->have_posts()) : $query_team_slider->the_post(); ?>
                        <li class="splide__slide text-center">
                            <div class="splide__slide__container">
                                <a class="text-stms" href="<?php esc_url(the_permalink()); ?>"><?php the_post_thumbnail('thumbnail', array('class' => 'component-team-slider__image mb-4')); ?></a>
                            </div>
                            <h2 class="mb-3 mt-2 component-team-slider__heading2"><a class="text-stms" href="<?php esc_url(the_permalink()); ?>"><?php the_title(); ?></a></h2>
                            <?php the_field('post_zespol_zajawka'); ?>
                            <div class="mt-4">
                                <?php
                                $social = get_field('post_zespol_socialmedia');
                                if ($social) {
                                    print $social['facebook'] ? '<span href="' . esc_url($social['facebook']) . '"></span>' : null;
                                }
                                ?>
                            </div>
                        </li>
                    <?php endwhile; ?>
                    <?php $query_team_slider->reset_postdata(); ?>
                <?php else : ?>
                    <?php _e('No data', 'theme'); ?>
                <?php endif; ?>
            </ul>
        </div>
    </div>
</div>

Environment for tests:

  • VsCode Version: 1.72.2
  • PHP Tools v1.18.10878 Pre-Release
  • OS Name: Microsoft Windows 11 Pro
  • OS Version: 10.0.22621 N/A Build 22621

VSCode settings:

{
    "workbench.colorTheme": "Darcula",
    "php.suggest.basic": false,
    "php.validate.enable": false,
    "emmet.excludeLanguages": [
        "markdown",
        "php"
    ],
    "php.problems.exclude": {
        "wp-admin/": true,
        "wp-includes/": true,
        "wp-content/plugins/": true,
        "vendor/": true,
    },
    "php.codeLens.enabled": false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions