facepook
@facepook
С детства болею неизлечимым сео-даром!

Почему не получается вывести шорткод в шаблоне Wordpress?

Всем доброго времени.
Я в своем шаблоне ВП всегда выводил шорткоды таким способом:
<?php echo do_shortcode( '[ваш_шорткод]' ); ?>
И все работало.

Сейчас пытаюсь вывести какой то здоровенный шорткод:

<?php echo do_shortcode( '[gridmaster grid_style="style-2" post_type="game" posts_per_page="10" orderby="date" order="DESC" content_from="excerpt" excerpt_type="characters" excerpt_length="15" show_read_more="yes" read_more_text="Скачать" grid_image_size="medium" grid_image_width="350" grid_image_height="200" link_thumbnail="no" link_thumbnail_to="post" show_filter="yes" filter_style="default" btn_all="no" taxonomy="category" hide_empty="1" multiple_select="no" toggle_filter_items="no" pagination_type="load_more" infinite_scroll="true" animation="true" heading_font_size='{"xs":"16px","sm":"18px","md":"20px","lg":"22px","xl":"24px"}' grid_col_gap='{"xs":"30","sm":"30","md":"30","lg":"30","xl":"30"}' grid_row_gap='{"xs":"30","sm":"30","md":"30","lg":"30","xl":"30"}' grid_item_per_row='{"xs":"1","sm":"2","md":"3","lg":"3","xl":"3"}' slider_args='{"arrows":"1","autoplaySpeed":"3000","infinite":"1","slidesToShow":{"xs":"1","sm":"2","md":"3","lg":"3","xl":"3"},"slidesToScroll":{"xs":"1","sm":"1","md":"1","lg":"1","xl":"1"}}']' ); ?>


И сайт сразу падает. Подскажите пожалуйста в чем дело
  • Вопрос задан
  • 56 просмотров
Решения вопроса 1
Mike_Ro
@Mike_Ro Куратор тега WordPress
Python, JS, WordPress, SEO, Bots, Adversting
Вариант с экранированием:
<?php echo do_shortcode( '[gridmaster grid_style="style-2" post_type="game" posts_per_page="10" orderby="date" order="DESC" content_from="excerpt" excerpt_type="characters" excerpt_length="15" show_read_more="yes" read_more_text="Скачать" grid_image_size="medium" grid_image_width="350" grid_image_height="200" link_thumbnail="no" link_thumbnail_to="post" show_filter="yes" filter_style="default" btn_all="no" taxonomy="category" hide_empty="1" multiple_select="no" toggle_filter_items="no" pagination_type="load_more" infinite_scroll="true" animation="true" heading_font_size=\'{"xs":"16px","sm":"18px","md":"20px","lg":"22px","xl":"24px"}\' grid_col_gap=\'{"xs":"30","sm":"30","md":"30","lg":"30","xl":"30"}\' grid_row_gap=\'{"xs":"30","sm":"30","md":"30","lg":"30","xl":"30"}\' grid_item_per_row=\'{"xs":"1","sm":"2","md":"3","lg":"3","xl":"3"}\' slider_args=\'{"arrows":"1","autoplaySpeed":"3000","infinite":"1","slidesToShow":{"xs":"1","sm":"2","md":"3","lg":"3","xl":"3"},"slidesToScroll":{"xs":"1","sm":"1","md":"1","lg":"1","xl":"1"}}\']' ); ?>

Вариант с NOWDOC синтаксисом, как подсказал Ivan Ustûžanin:
<?php echo do_shortcode( '[gridmaster grid_style="style-2" post_type="game" posts_per_page="10" orderby="date" order="DESC" content_from="excerpt" excerpt_type="characters" excerpt_length="15" show_read_more="yes" read_more_text="Скачать" grid_image_size="medium" grid_image_width="350" grid_image_height="200" link_thumbnail="no" link_thumbnail_to="post" show_filter="yes" filter_style="default" btn_all="no" taxonomy="category" hide_empty="1" multiple_select="no" toggle_filter_items="no" pagination_type="load_more" infinite_scroll="true" animation="true" heading_font_size=\'{"xs":"16px","sm":"18px","md":"20px","lg":"22px","xl":"24px"}\' grid_col_gap=\'{"xs":"30","sm":"30","md":"30","lg":"30","xl":"30"}\' grid_row_gap=\'{"xs":"30","sm":"30","md":"30","lg":"30","xl":"30"}\' grid_item_per_row=\'{"xs":"1","sm":"2","md":"3","lg":"3","xl":"3"}\' slider_args=\'{"arrows":"1","autoplaySpeed":"3000","infinite":"1","slidesToShow":{"xs":"1","sm":"2","md":"3","lg":"3","xl":"3"},"slidesToScroll":{"xs":"1","sm":"1","md":"1","lg":"1","xl":"1"}}\']' ); ?>

Если использовать нормальную IDE, то она сообщит о возможных проблемах:
67347946022ff024286243.png
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы