Wordpress Bundle
  • What is Wordpress Bundle?
  • Getting started
    • Installation
    • Wordpress
    • Router
    • Cron job
    • Templates
  • Reference
    • Argument resolver
    • Controller
      • AdminAction
      • BlogController
      • FrontAction
      • WordpressAction
    • Entity
      • Block
      • Blog
      • Comment
      • File
      • Image
      • Menu
      • MenuItem
      • Post
      • Term
      • User
    • Repository
      • CommentRepository
      • PostRepository
      • TermRepository
      • UserRepository
    • Service
      • PaginationService
      • BreacrumbService
  • Guides
    • Server requirements
    • Install plugins
    • Use Multisite
    • Gutenberg
    • WP Steroids plugin
      • Image options
      • Maintenance
      • Admin pages removal
      • WYSIWYG Editor
      • Feature Support
      • Multi-site configuration
      • Constants definition
      • ACF configuration
      • Menu
      • Custom Post type
      • Advanced permalink settings
      • Custom Taxonomy
      • Templates
      • Page states
      • External table viewer
      • Roles
      • Optimisations
      • Security
      • Search
    • Twig Cookbook
    • Inject variables in all templates
    • Internationalization
    • Extending Wordpress Bundle
    • Error pages
    • Site health
  • Integrations
    • Advanced Custom Fields
      • Install ACF PRO
  • Extras
    • Migrating from 1.x to 2.0
    • Roadmap
    • Changelog
    • Alternatives
Powered by GitBook
On this page
  • Custom post type
  • Other entities

Was this helpful?

  1. Guides

Extending Wordpress Bundle

Custom post type

Custom posts can extend the Post entity to add some preprocess or new functions,

in the /src folder, add an Entity folder, then create a new class for the post_type using Pascal case

namespace App\Entity;

use Metabolism\WordpressBundle\Entity\Post;

class Guide extends Post
{
  public $is_new;
    
  public function __construct($id = null)
  {
    parent::__construct($id);

    $this->is_new = true;
  }
}

Other entities

Menu, Comment, MenuItem, Product, Term and User can be extended by creating the same file in the /src/Entity folder.

PreviousInternationalizationNextError pages

Last updated 3 years ago

Was this helpful?