@thedexploit
Сайтами маюсь

Кастомный тип записи не разбивает текст на абзацы, выдает прост полотно. Как исправить?

Стоит тема учебного портала, есть кастомный тип записи "учителя". Весь тест идет слитно без абзацев. Только если в ручную поставить , только тогда начинает разделять.
Обыскал вроде бы уже все, нигде не могу найти ничего, что бы влияло на это.

remove_filter('the_content', 'wpautop'); - тоже нигде нет.

Как можно "заставить" его разделять текст толково?
Собственно объявление типа постов - "учитель"

<?php

/**
 *
 * CPT "Teacher"
 *
 */
class Academia_CPT_Teacher {

    /**
     * Custom Post Type slug.
     * @var string
     */
    private $post_type = 'academia_teacher';

    /**
     * Custom taxonomy - course name - for post type
     * @var string
     */
    private $taxonomy = 'course_name';

    /**
     * Instance of class.
     * @var null|Academia_CPT_Teacher
     */
    private static $instance;

    /**
     * Initialization
     *
     * @return Academia_CPT_Teacher
     */
    public static function init() {
        if ( null === self::$instance ) {
            self::$instance = new self;
        }

        return self::$instance;
    }

    private function __construct() {
        add_action( 'init', array( $this, 'register_post_type' ), 0 );
        add_action( 'init', array( $this, 'register_taxonomy' ), 0 );
    }

    public function register_post_type() {
        $labels = array(
            'name'                  => _x( 'Teachers', 'Post Type General Name', 'academia' ),
            'singular_name'         => _x( 'Teacher', 'Post Type Singular Name', 'academia' ),
            'menu_name'             => __( 'Teachers', 'academia' ),
            'name_admin_bar'        => __( 'Teachers', 'academia' ),
            'archives'              => __( 'Teacher Archives', 'academia' ),
            'parent_item_colon'     => __( 'Parent Teacher:', 'academia' ),
            'all_items'             => __( 'All Teachers', 'academia' ),
            'add_new_item'          => __( 'Add New Teacher', 'academia' ),
            'add_new'               => __( 'Add New', 'academia' ),
            'new_item'              => __( 'New Teacher', 'academia' ),
            'edit_item'             => __( 'Edit Teacher', 'academia' ),
            'update_item'           => __( 'Update Teacher', 'academia' ),
            'view_item'             => __( 'View Teacher', 'academia' ),
            'search_items'          => __( 'Search Teacher', 'academia' ),
            'not_found'             => __( 'Not found', 'academia' ),
            'not_found_in_trash'    => __( 'Not found in Trash', 'academia' ),
            'featured_image'        => __( 'Profile Image', 'academia' ),
            'set_featured_image'    => __( 'Set profile image', 'academia' ),
            'remove_featured_image' => __( 'Remove profile image', 'academia' ),
            'use_featured_image'    => __( 'Use as profile image', 'academia' ),
            'insert_into_item'      => __( 'Insert into teacher', 'academia' ),
            'uploaded_to_this_item' => __( 'Uploaded to this item', 'academia' ),
            'items_list'            => __( 'Teachers list', 'academia' ),
            'items_list_navigation' => __( 'Teachers list navigation', 'academia' ),
            'filter_items_list'     => __( 'Filter teachers list', 'academia' ),
        );
        $args = array(
            'label'                 => __( 'Teacher', 'academia' ),
            'description'           => __( 'Add and manage teacher profile.', 'academia' ),
            'labels'                => $labels,
            'supports'              => array( 'title', 'editor', 'thumbnail' ),
            'taxonomies'            => array( ),
            'hierarchical'          => false,
            'public'                => true,
            'show_ui'               => true,
            'show_in_menu'          => true,
            'menu_position'         => 30,
            'menu_icon'             => 'dashicons-businessman',
            'show_in_admin_bar'     => true,
            'show_in_nav_menus'     => true,
            'can_export'            => true,
            'has_archive'           => true,
            'exclude_from_search'   => false,
            'publicly_queryable'    => true,
            'capability_type'       => 'page',
            'rewrite'               => array( 'slug' => 'teacher' ),
        );

        register_post_type( $this->post_type, $args );
    }


    /**
     *
     * Register Taxonomy
     *
     */

    public function register_taxonomy() {
        $labels = array(
            'name'                       => _x( 'Course Names', 'Taxonomy General Name', 'academia' ),
            'singular_name'              => _x( 'Course Name', 'Taxonomy Singular Name', 'academia' ),
            'menu_name'                  => __( 'Course Name', 'academia' ),
            'all_items'                  => __( 'All Items', 'academia' ),
            'parent_item'                => __( 'Parent Item', 'academia' ),
            'parent_item_colon'          => __( 'Parent Item:', 'academia' ),
            'new_item_name'              => __( 'New Item Name', 'academia' ),
            'add_new_item'               => __( 'Add New', 'academia' ),
            'edit_item'                  => __( 'Edit', 'academia' ),
            'update_item'                => __( 'Update', 'academia' ),
            'separate_items_with_commas' => __( 'Separate with commas', 'academia' ),
            'search_items'               => __( 'Search', 'academia' ),
            'add_or_remove_items'        => __( 'Add or remove items', 'academia' ),
            'choose_from_most_used'      => __( 'Choose from the most used items', 'academia' ),
            'not_found'                  => __( 'Not Found', 'academia' )
        );
        $args = array(
            'labels'                     => $labels,
            'hierarchical'               => true,
            'public'                     => false,
            'show_ui'                    => true,
            'show_admin_column'          => true,
            'show_in_nav_menus'          => false,
            'show_tagcloud'              => false,
            'rewrite'                    => true,
        );

        register_taxonomy( $this->taxonomy, $this->post_type, $args );
    }
}
  • Вопрос задан
  • 123 просмотра
Пригласить эксперта
Ответы на вопрос 1
trampick
@trampick
Веб-разработчик
Используй фильтр apply_filters('the_content', переменная).
Например,
<?php
  echo apply_filters('the_content', get_the_content());
 ?>

или
<?php
  echo apply_filters('the_content', get_the_excerpt());
 ?>

или
<?php
  echo apply_filters('the_content', get_field('myfield'));
 ?>
Ответ написан
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы