Title: Select Primary Category
Author: denizozsen
Published: <strong>13. juni, 2018</strong>
Last modified: 13. juni, 2018

---

Søg plugins

Dette plugin **er ikke blevet testet med de seneste 3 større udgivelser af WordPress**.
Det vedligeholdes eller understøttes muligvis ikke længere og kan have kompatibilitetsproblemer,
når det bruges med nyere versioner af WordPress.

![](https://s.w.org/plugins/geopattern-icon/deniz-primary-category.svg)

# Select Primary Category

 Af [denizozsen](https://profiles.wordpress.org/denizozsen/)

[Download](https://downloads.wordpress.org/plugin/deniz-primary-category.zip)

 * [Detaljer](https://da.wordpress.org/plugins/deniz-primary-category/#description)
 * [Vurderinger](https://da.wordpress.org/plugins/deniz-primary-category/#reviews)
 *  [Installation](https://da.wordpress.org/plugins/deniz-primary-category/#installation)
 * [Udvikling](https://da.wordpress.org/plugins/deniz-primary-category/#developers)

 [Support](https://wordpress.org/support/plugin/deniz-primary-category/)

## Beskrivelse

Features:
 * Ability to designate a primary category for posts and custom post types.*
Supports custom post types and custom taxonomies with hierarchical structure. * 
Category in permalink is the primary category, if one is set. * Shortcode for displaying
posts with a specific primary category. * CLI command for listing posts with a specific
primary category.

## Installation

 1. Add the plugin folder to WordPress’ plugin directory.
 2. Activate the plugin from Admin > Plugins.
 3. Start using it.

## FAQ

  Installation Instructions

 1. Add the plugin folder to WordPress’ plugin directory.
 2. Activate the plugin from Admin > Plugins.
 3. Start using it.

  When using the shortcode, do I need to use the primary category’s ID, slug or 
name?

You can use either of them. E.g. assuming a category with ID 3, slug ‘ground-coffee’
and name ‘Ground Coffee’.
 the following shortcode definitions will all work:

    ```
    [posts_by_primary_category category="3"]
    [posts_by_primary_category category="ground-coffee"]
    [posts_by_primary_category category="Ground Coffee"]
    ```

  Developers’ Notes

If you want to fetch posts belonging to a particular category (or, more generally,
belonging to a particular term)
 you can use this:

    ```
    if ( class_exists( 'SPC_Queries' ) ) {
        /*
         * Let's fetch 10 published posts with primary category set to category ID 2.
         */
        $spc_queries =  SPC_Infrastructure_Container::get_instance()->get( 'SPC_Queries' );
        $posts = $spc_queries->get_primary_term_posts( 2, array(
            'post_status'    => 'publish',
            'posts_per_page' => 10,
            'post_type'      => 'post',
        ) );
    }
    ```

You can just as well pass a category slug or name, instead of its ID, if you prefer.

## Anmeldelser

Der er ingen anmeldelser for denne widget.

## Bidragsydere & udviklere

“Select Primary Category” er open source-software. Følgende personer har bidraget
til dette plugin.

Bidragsydere

 *   [ denizozsen ](https://profiles.wordpress.org/denizozsen/)

[Oversæt “Select Primary Category” til dit eget sprog.](https://translate.wordpress.org/projects/wp-plugins/deniz-primary-category)

### Interesseret i udvikling?

[Gennemse koden](https://plugins.trac.wordpress.org/browser/deniz-primary-category/),
tjek [SVN repository](https://plugins.svn.wordpress.org/deniz-primary-category/),
eller abonner på [udviklerloggen](https://plugins.trac.wordpress.org/log/deniz-primary-category/)
via [RSS](https://plugins.trac.wordpress.org/log/deniz-primary-category/?limit=100&mode=stop_on_copy&format=rss).

## Ændringslog

#### 1.0

 * Initial public release.

## Meta

 *  Version **1.0**
 *  Senest opdateret **8 år siden**
 *  Aktive installationer **Færre end 10**
 *  WordPress-version ** 4.5 eller højere **
 *  Sprog
 * [English (US)](https://wordpress.org/plugins/deniz-primary-category/)
 * Tags
 * [category](https://da.wordpress.org/plugins/tags/category/)[primary](https://da.wordpress.org/plugins/tags/primary/)
   [taxonomy](https://da.wordpress.org/plugins/tags/taxonomy/)
 *  [Avanceret visning](https://da.wordpress.org/plugins/deniz-primary-category/advanced/)

## Bedømmelser

Der er endnu ikke indsendt nogen anmeldelser.

[Din anmeldelse](https://wordpress.org/support/plugin/deniz-primary-category/reviews/#new-post)

[Se alle anmeldelser](https://wordpress.org/support/plugin/deniz-primary-category/reviews/)

## Bidragsydere

 *   [ denizozsen ](https://profiles.wordpress.org/denizozsen/)

## Support

Har du noget at sige? Har du brug for hjælp?

 [Vis supportforum](https://wordpress.org/support/plugin/deniz-primary-category/)