# What is Wordpress Bundle?

This package is a Symfony Bundle designed to use WordPress with Symfony.

{% hint style="info" %}
**How does it work ?** When the WordPress bundle is loaded, it includes the minimal amount of WordPress Core files to allow usage of WordPress functions and plugins inside Symfony.
{% endhint %}

> #### Blog Controller example for single page

```php
/**
 * src/Controller/BlogController.php
 *
 * @param Post $post
 * @param PostRepository $postRepository
 * @param BreadcrumbService $breadcrumbService
 * @return Response
 */
public function pageAction(Post $post, PostRepository $postRepository)
{
    $context = [];
    
    // get current post
    $context['post'] = $post;
    
    // find 10 "brands" ordered by title
    $context['brands'] = $postRepository->findBy(['post_type'=>'brand'], ['title'=>'ASC'], 10);

    return $this->render('page.html.twig', $context);
}
```

#### Twig template example for single page

```twig
{# templates/page.html.twig #}

{% extends 'layout.html.twig' %}

{% block body %}
<article id="post-{{ post.ID }}" class="{{ post.class }}">

    {% if post.thumbnail %}
        <img src="{{ post.thumbnail|resize(800, 600) }}" alt="{{ post.thumbnail.alt }}"/>
    {% endif %}

    <div class="entry-content">
        
        {{ post.content|raw }}
        
        {# or #}
        
        {% for block in post.blocks %}
            {% include 'block/'~block.name~'.html.twig' %}
        {% endfor %}
    </div>
    
    <small>{{ post.metafields.mention }}</small>
    
    {% for brand in brands %}
        {% include 'brand.html.twig' %}
    {% endfor %}

</article>
{% endblock body %}
```

## Demo

**Got 2 minutes?** Checkout the demo of our bundle

{% embed url="<https://github.com/wearemetabolism/wordpress-bundle-demo/tree/2.0.x>" %}

{% hint style="info" %}
This is an implementation of the Twenty Nineteen WordPress theme for wordpress-bundle.
{% endhint %}

## Feature list

<details>

<summary>Using Composer</summary>

* Install/update Wordpress via composer
* Install/update plugins via composer

</details>

<details>

<summary>Using Symfony</summary>

* Template engine
* Folder structure
* Http Cache
* Routing
* YML configuration
* DotEnv
* Enhanced Security ( Wordpress is 'hidden' )
* Dynamic image resize
* MVC

</details>

<details>

<summary>Using Wordpress Bundle</summary>

* Post/Term Repository
* Controller argument resolver for post(s), term and user
* Symfony Cache invalidation on update ( Varnish compatible )
* Post/Image/Menu/Term/User/Comment/Site/Block entity
* Wordpress predefined routes
* Site health checker url
* Static site export command

</details>

<details>

<summary>Using  WP Steroids Plugin</summary>

* Wordpress configuration using YML ( [view sample](https://github.com/wearemetabolism/wordpress-bundle/blob/2.0.x/config/wordpress.yaml) )
* Permalink configuration for custom post type and taxonomy
* Gutenberg editor resize
* Maintenance mode
* Backup download in dev mode
* Build hook
* Disabled automatic update
* Enhanced Security
* Better guid using RFC 4122 compliant UUID version 5
* Multisite images sync ( for multisite as multilanguage )
* SVG Support
* Better Performance
* Wordpress Bugfix
* CSS Fix
* Relative urls
* Multisite post deep copy ( with multisite-language-switcher plugin )
* Custom datatable support with view and delete actions in admin

</details>

## Getting started

Follow our handy guides to get started on the basics as quickly as possible:

{% content-ref url="/pages/t3Clot4iSUoWwZQYOQnJ" %}
[Installation](/symfony-wordpress-bundle/getting-started/installation.md)
{% endcontent-ref %}

{% content-ref url="/pages/oci6owpOSP6dAK2HHDbW" %}
[Wordpress](/symfony-wordpress-bundle/getting-started/wordpress.md)
{% endcontent-ref %}

{% content-ref url="/pages/Q3mMGpCwieaB0tlRnpoq" %}
[Router](/symfony-wordpress-bundle/getting-started/router.md)
{% endcontent-ref %}

{% content-ref url="/pages/LB1hG0MeWdY6XdmrBUf2" %}
[Cron job](/symfony-wordpress-bundle/getting-started/cron-job.md)
{% endcontent-ref %}

{% content-ref url="/pages/RTwTGtMkYupKqBau4hBR" %}
[Templates](/symfony-wordpress-bundle/getting-started/templates.md)
{% endcontent-ref %}

## Fundamentals: Dive a little deeper

Learn the fundamentals of Wordpress Bundle to get a deeper understanding of our main features:

{% content-ref url="/pages/6UjNSyvJp76rhFChr0cR" %}
[Argument resolver](/symfony-wordpress-bundle/reference/argument-resolver.md)
{% endcontent-ref %}

{% content-ref url="/pages/tIG1m4yIPngGLS7vYBaN" %}
[Controller](/symfony-wordpress-bundle/reference/controller.md)
{% endcontent-ref %}

{% content-ref url="/pages/ZBLHZEpN73FBGSRAOhhz" %}
[Entity](/symfony-wordpress-bundle/reference/entity.md)
{% endcontent-ref %}

{% content-ref url="/pages/wG0dQZms678f9S7aw4A5" %}
[Repository](/symfony-wordpress-bundle/reference/repository.md)
{% endcontent-ref %}

{% content-ref url="/pages/vvLCqOZGuY02TWaAFCvr" %}
[Service](/symfony-wordpress-bundle/reference/service.md)
{% endcontent-ref %}

{% content-ref url="/pages/qNWKluk3jnTP82pCNXJQ" %}
[Broken mention](broken://pages/qNWKluk3jnTP82pCNXJQ)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://metabolism.gitbook.io/symfony-wordpress-bundle/what-is-wordpress-bundle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
