Support » Plugin: Content Blocks (Custom Post Widget) » Classes and Tags for new content blocks

  • Hello.

    I would wish to add Classes and Tags to the new created content blocks. Is it possible?

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Johan van der Wijk

    (@vanderwijk)

    Hi Aris,

    Yes, you can add tag support to the content_block custom post type. You can do that either by modifying line 145 of the plugin file post-widget.php (not recommended) or you can follow the steps of this tutorial https://gregrickaby.com/2016/06/modify-wordpress-custom-post-type/ which shows you how to filter the custom post type options (the preferred solution).

    You can add classes to your content blocks by using this plugin: https://nl.wordpress.org/plugins/widget-css-classes/

    Note that all content blocks have a unique ID based on the post id and are wrapped in a div with class content-block so you should be able to target them without additional classes.

    Good luck!

    Thank you Johan.
    Your answer is very helpful.

    One more question please:
    In my Content Blocks I wish to write different kind of questions about the preceding post. Each Content Block will contains a different question.

    May I use categories and tags for each type of Block Content?

    Thank you again.

    Aris

    Plugin Author Johan van der Wijk

    (@vanderwijk)

    Yes, you can use categories and tags if you follow the steps of the tutorial link above. This is the filter you will have to add:

    'taxonomies' => array('tags', 'category' ),

    Thank you Johan.

    Hi Johan.

    I the tutorial I click this link https://gregrickaby.com/2016/06/modify-wordpress-custom-post-type/ and then ” post.php “.

    Now I am seeing and that piece of code:

    1017	        $args = apply_filters( 'register_post_type_args', $args, $post_type );
    1018	
    1019	        $has_edit_link = ! empty( $args['_edit_link'] );
    1020	
    1021	        // Args prefixed with an underscore are reserved for internal use.
    1022	        $defaults = array(
    1023	                'labels'               => array(),
    1024	                'description'          => '',
    1025	                'public'               => false,
    1026	                'hierarchical'         => false,
    1027	                'exclude_from_search'  => null,
    1028	                'publicly_queryable'   => null,
    1029	                'show_ui'              => null,
    1030	                'show_in_menu'         => null,
    1031	                'show_in_nav_menus'    => null,
    1032	                'show_in_admin_bar'    => null,
    1033	                'menu_position'        => null,
    1034	                'menu_icon'            => null,
    1035	                'capability_type'      => 'post',
    1036	                'capabilities'         => array(),
    1037	                'map_meta_cap'         => null,
    1038	                'supports'             => array(),
    1039	                'register_meta_box_cb' => null,
    1040	                'taxonomies'           => array(),
    1041	                'has_archive'          => false,
    1042	                'rewrite'              => true,
    1043	                'query_var'            => true,
    1044	                'can_export'           => true,
    1045	                'delete_with_user'     => null,
    1046	                '_builtin'             => false,
    1047	                '_edit_link'           => 'post.php?post=%d',
    1048	        );

    Where I must paste the code you have sent to me?

    ‘taxonomies’ => array(‘tags’, ‘category’ ),

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Classes and Tags for new content blocks’ is closed to new replies.