Exemple #1
0
/**
 * Conditional tag to check if viewing a subject archive.
 *
 * @since  1.0.0
 * @access public
 * @param  mixed  $term
 * @return bool
 */
function thds_is_subject($term = '')
{
    return apply_filters('thds_is_subject', is_tax(thds_get_subject_taxonomy(), $term));
}
/**
 * Filters the term updated messages in the admin.
 *
 * @since  1.0.0
 * @access public
 * @param  array  $messages
 * @return array
 */
function thds_term_updated_messages($messages)
{
    $subject_taxonomy = thds_get_subject_taxonomy();
    $feature_taxonomy = thds_get_feature_taxonomy();
    // Add the subject messages.
    $messages[$subject_taxonomy] = array(0 => '', 1 => __('Subject added.', 'theme-designer'), 2 => __('Subject deleted.', 'theme-designer'), 3 => __('Subject updated.', 'theme-designer'), 4 => __('Subject not added.', 'theme-designer'), 5 => __('Subject not updated.', 'theme-designer'), 6 => __('Subjects deleted.', 'theme-designer'));
    // Add the feature messages.
    $messages[$feature_taxonomy] = array(0 => '', 1 => __('Feature added.', 'theme-designer'), 2 => __('Feature deleted.', 'theme-designer'), 3 => __('Feature updated.', 'theme-designer'), 4 => __('Feature not added.', 'theme-designer'), 5 => __('Feature not updated.', 'theme-designer'), 6 => __('Features deleted.', 'theme-designer'));
    return $messages;
}
 /**
  * Renders a subjects dropdown below the table nav.
  *
  * @since  1.0.0
  * @access public
  * @return void
  */
 public function subjects_dropdown()
 {
     $this->terms_dropdown(thds_get_subject_taxonomy());
 }
    /**
     * Displays the permalinks help tab.
     *
     * @since  1.0.0
     * @access public
     * @return void
     */
    public function help_tab_permalinks()
    {
        ?>

		<ul>
			<li><?php 
        _e('<strong>Portfolio Base:</strong> The primary URL for the portfolio section on your site. It lists your portfolio themes.', 'theme-designer');
        ?>
</li>
			<li>
				<?php 
        _e('<strong>Project Slug:</strong> The slug for single portfolio themes. You can use something custom, leave this field empty, or use one of the following tags:', 'theme-designer');
        ?>
				<ul>
					<li><?php 
        printf(esc_html__('%s - The theme author name.', 'theme-designer'), '<code>%author%</code>');
        ?>
</li>
					<li><?php 
        printf(esc_html__('%s - The theme subject.', 'theme-designer'), '<code>%' . thds_get_subject_taxonomy() . '%</code>');
        ?>
</li>
					<li><?php 
        printf(esc_html__('%s - The theme tag.', 'theme-designer'), '<code>%' . thds_get_feature_taxonomy() . '%</code>');
        ?>
</li>
				</ul>
			</li>
			<li><?php 
        _e('<strong>Category Slug:</strong> The base slug used for portfolio subject archives.', 'theme-designer');
        ?>
</li>
			<li><?php 
        _e('<strong>Tag Slug:</strong> The base slug used for portfolio tag archives.', 'theme-designer');
        ?>
</li>
			<li><?php 
        _e('<strong>Author Slug:</strong> The base slug used for portfolio author archives.', 'theme-designer');
        ?>
</li>
		</ul>
	<?php 
    }
Exemple #5
0
/**
 * If a theme has `%portfolio_subject%` or `%portfolio_feature%` in its permalink structure,
 * it must have a term set for the taxonomy.  This function is a callback on `save_post`
 * that checks if a term is set.  If not, it forces the first term of the taxonomy to be
 * the selected term.
 *
 * @since  1.0.0
 * @access public
 * @param  int    $post_id
 * @return void
 */
function thds_force_term_selection($post_id)
{
    if (thds_is_theme($post_id)) {
        $theme_base = thds_get_theme_rewrite_base();
        $subject_tax = thds_get_subject_taxonomy();
        if (false !== strpos($theme_base, "%{$subject_tax}%")) {
            thds_set_term_if_none($post_id, $subject_tax, thds_get_default_subject());
        }
    }
}