Skip to main content

Home/ Wordpress/ Group items tagged slug

Rss Feed Group items tagged

Vernon Fowler

WordPress › WP Glossary « WordPress Plugins - 3 views

  • Display and link to glossary with slug 'seo' [glossary slug='seo'] Auto search word for matching glossary term (e.g. 'seo') [glossary]SEO[/glossary] Apply glossary term with slug 'seo' to post content 'search engine optimisation' [glossary slug='seo']search engine optimisation[/glossary]
  • [glossary]SEO[/glossary]
Vernon Fowler

Function Reference/get template part « WordPress Codex - 2 views

  •  
    "Load a template part into a template (other than header, sidebar, footer). Makes it easy for a theme to reuse sections of code and an easy way for child themes to replace sections of their parent theme. Includes the named template part for a theme or if a name is specified then a specialized part will be included. If the theme contains no {slug}.php file then no template will be included. "
Anna Johansson

Add page/post slug class to menu item classes | WPreso - 0 views

  •  

    function add_slug_class_to_menu_item($output){
    $ps = get_option('permalink_structure');
    if(!empty($ps)){
    $idstr = preg_match_all('/
    foreach($matches[1] as $mid){
Vernon Fowler

Post Types « WordPress Codex - 1 views

  • it is better if you prefix your identifier with a short namespace that identifies your plugin, theme or website that implements the custom post type. For example: acme_product or aw_product for products post type used by a hypothetical ACMEWidgets.com website
  • Namespacing your custom post type identifier will not guarantee against conflicts but will certainly minimize their likelihood.
  • Do pay close attention to not having your custom post type identifier exceed 20 characters though, as the post_type column in the database is currently a VARCHAR field of that length.
  • ...6 more annotations...
  • register_post_type( 'acme_product', array( 'labels' => array( 'name' => __( 'Products' ), 'singular_name' => __( 'Product' ) ), 'public' => true, 'has_archive' => true, ) );
  • When you namespace a custom post type identifier and still want to use a clean URL structure, you need to set the rewrite argument of the register_post_type() function. For example, assuming the ACME Widgets example from above:
  • 'rewrite' => array('slug' => 'products'),
  • Note: In some cases, the permalink structure must be updated in order for the new template files to be accessed when viewing posts of a custom post type.
  • single posts of a custom post type will use single-{post_type}.php and their archives will use archive-{post_type}.php where {post_type} is the $post_type argument of the register_post_type() function.
  • In any template file of the WordPress theme system, you can also create new queries to display posts from a specific post type. This is done via the post_type argument of the WP_Query object.
1 - 5 of 5
Showing 20 items per page