Last active
December 4, 2018 16:12
-
-
Save sophiawzey/15f9406db3aad92a8a89e116d8599cc4 to your computer and use it in GitHub Desktop.
[Custom Post Type Testimonials ] #wordpress #cpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register testimonials | |
function custom_testimonials() { | |
$labels = array( | |
'name' => _x( 'Testimonials', 'Post Type General Name', 'text_domain' ), | |
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'text_domain' ), | |
'menu_name' => __( 'Testimonials', 'text_domain' ), | |
'name_admin_bar' => __( 'Testimonials', 'text_domain' ), | |
'archives' => __( 'Testimonial Archives', 'text_domain' ), | |
'attributes' => __( 'Testimonial Attributes', 'text_domain' ), | |
'parent_item_colon' => __( 'Parent Testimonial', 'text_domain' ), | |
'all_items' => __( 'All Testimonials', 'text_domain' ), | |
'add_new_item' => __( 'Add New Testimonial', 'text_domain' ), | |
'add_new' => __( 'Add New', 'text_domain' ), | |
'new_item' => __( 'New Testimonial', 'text_domain' ), | |
'edit_item' => __( 'Edit Testimonial', 'text_domain' ), | |
'update_item' => __( 'Update Testimonial', 'text_domain' ), | |
'view_item' => __( 'View Testimonial', 'text_domain' ), | |
'view_items' => __( 'View Testimonials', 'text_domain' ), | |
'search_items' => __( 'Search Testimonial', 'text_domain' ), | |
'not_found' => __( 'Not found', 'text_domain' ), | |
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), | |
'featured_image' => __( 'Featured Image', 'text_domain' ), | |
'set_featured_image' => __( 'Set featured image', 'text_domain' ), | |
'remove_featured_image' => __( 'Remove featured image', 'text_domain' ), | |
'use_featured_image' => __( 'Use as featured image', 'text_domain' ), | |
'insert_into_item' => __( 'Insert into Testimonial', 'text_domain' ), | |
'uploaded_to_this_item' => __( 'Uploaded to this Testimonial', 'text_domain' ), | |
'items_list' => __( 'Testimonials list', 'text_domain' ), | |
'items_list_navigation' => __( 'Testimonials list navigation', 'text_domain' ), | |
'filter_items_list' => __( 'Filter Testimonials list', 'text_domain' ), | |
); | |
$args = array( | |
'label' => __( 'Testimonial', 'text_domain' ), | |
'description' => __( 'Nice things said by clients and customers', 'text_domain' ), | |
'labels' => $labels, | |
'supports' => array( 'title', 'editor', 'revisions', 'custom-fields', 'page-attributes' ), | |
// 'taxonomies' => array( 'category', 'post_tag' ), | |
'hierarchical' => false, | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'menu_position' => 5, | |
'menu_icon' => 'dashicons-format-quote', | |
'show_in_admin_bar' => true, | |
'show_in_nav_menus' => true, | |
'can_export' => true, | |
'has_archive' => true, | |
'exclude_from_search' => true, | |
'publicly_queryable' => true, | |
'capability_type' => 'page', | |
); | |
register_post_type( 'testimonials', $args ); | |
// not always needed | |
register_taxonomy( 'testimonial_category', // register custom taxonomy - category | |
'testimonials', | |
array( | |
'hierarchical' => true, | |
'labels' => array( | |
'name' => 'Testimonial Categories', | |
'singular_name' => 'Testimonial Category', | |
) | |
) | |
); | |
} | |
add_action( 'init', 'custom_testimonials', 0 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$red: red !default; | |
$light-gray: gray !default; | |
.testimonials { | |
display: flex; | |
align-items: center; | |
@media (min-width: 640px) { | |
padding: 0 4rem; | |
} | |
&__title { | |
text-align: center; | |
margin: 1rem 0; | |
} | |
&__wrap { | |
padding: 2rem 2rem; | |
} | |
&__icon { | |
color: $light-gray; | |
font-size: 5rem; | |
text-align: center; | |
@media (min-width: 640px) { | |
margin: -2rem 2rem 0; | |
text-align: left; | |
} | |
} | |
&__cite { | |
margin: 1.75rem 0 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment