Example #1
0
/**
 * Registers post types needed by the plugin.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function thds_register_post_types()
{
    // Set up the arguments for the theme post type.
    $theme_args = array('description' => thds_get_archive_description(), 'public' => true, 'publicly_queryable' => true, 'show_in_nav_menus' => false, 'show_in_admin_bar' => true, 'exclude_from_search' => false, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => null, 'menu_icon' => 'dashicons-art', 'can_export' => true, 'delete_with_user' => false, 'hierarchical' => false, 'has_archive' => thds_get_rewrite_base(), 'query_var' => 'theme_project', 'capability_type' => 'theme_project', 'map_meta_cap' => true, 'capabilities' => thds_get_theme_capabilities(), 'labels' => thds_get_theme_labels(), 'rewrite' => array('slug' => thds_get_theme_rewrite_slug(), 'with_front' => false, 'pages' => true, 'feeds' => true, 'ep_mask' => EP_PERMALINK), 'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-background', 'custom-header'));
    // Register the post types.
    register_post_type(thds_get_theme_post_type(), apply_filters('thds_theme_post_type_args', $theme_args));
}
Example #2
0
/**
 * Returns the author rewrite slug used for author archives.
 *
 * @since  1.0.0
 * @access public
 * @return string
 */
function thds_get_author_rewrite_slug()
{
    $rewrite_base = thds_get_rewrite_base();
    $author_base = thds_get_author_rewrite_base();
    $slug = $author_base ? trailingslashit($rewrite_base) . $author_base : $rewrite_base;
    return apply_filters('thds_get_author_rewrite_slug', $slug);
}
    /**
     * Author rewrite base field callback.
     *
     * @since  1.0.0
     * @access public
     * @return void
     */
    public function field_author_rewrite_base()
    {
        ?>

		<label>
			<code><?php 
        echo esc_url(home_url(thds_get_rewrite_base() . '/'));
        ?>
</code>
			<input type="text" class="regular-text code" name="thds_settings[author_rewrite_base]" value="<?php 
        echo esc_attr(thds_get_author_rewrite_base());
        ?>
" />
		</label>
	<?php 
    }