background preloader

WP Custom Post Types (CPT)

Facebook Twitter

Templates maison : Posez-moi la question n°4. Vendredi 23 janvier se déroulait le WordCamp Paris 2015.

Templates maison : Posez-moi la question n°4

Lors de ce WordCamp et comme en 2014, je tenais le Happiness Bar accompagné de Alex Concha et d’autres bénévoles désireux d’aider les visiteurs. Question time La toute première question de cette matinée était technique, la voici : « Comment charger un template quand mon article a un format spécifique (post format) ? Front End Posting with Advanced Custom Fields Pro - The Stiz Media.

This tutorial shows you how to build a page template that will allow you to create new posts (or custom post type posts) from the front end of your WordPress website using the powerful Advanced Custom Fields Pro (not free) plugin.

Front End Posting with Advanced Custom Fields Pro - The Stiz Media

This tutorial is working in Genesis, but you can modify it to work in most themes. Part 2 shows you how to edit posts with ACF Pro. There are lots of other cool plugins like Gravity Forms, Ninja Forms, and Formidable Pro, that allow front end posting, but I prefer using ACF since it also seamlessly integrates any custom fields you may be using as well.

ACF Pro has a really powerful function called acf_form() that gives you the ability to render a form (metabox) on the front end of your site. Then there are filters available that allow you to manipulate the data from the fields and use it to create posts. There’s a video at the end of this post if you wanna see it in action. Here’s how we do it. Create The Metabox(es) WordPress Custom page avec ACF - Fabien VEYRAT. La force principale de WordPress reste sa facilité de prise en main que ce soit pour les développeurs ou pour les utilisateurs finaux.

WordPress Custom page avec ACF - Fabien VEYRAT

Il y est donc très simple de réaliser des modèles de pages sous ce CMS et cela vous permet d’obtenir facilement et rapidement le résultat visuel escompté. Wordpress & ACF Pro : Créer des formulaires en front end - Fabien VEYRAT. Venant de passer plusieurs heures à essayer de faire fonctionner un formulaire d’inscription en front-end avec ACF Pro (afin d’éviter de multiplier les extensions), je me dis que c’est peut-être également votre cas !

Wordpress & ACF Pro : Créer des formulaires en front end - Fabien VEYRAT

Mais plutôt que de ne vous parler que du formulaire d’inscription, je vous propose de traiter plus globalement des formulaires que vous voulez peut-être mettre en front-end de son site. Creating a WP archive with custom field filter. Overview This video tutorial will cover the basics of creating a WP archive that displays posts filtered by a checkbox custom field.

Please watch the video first, and use the code below to kick start your project! Usage This snippet of code is placed within the functions.php file and modifies the WP_Query args based on the available $_GET params. functions.php This snippet of code is used within a template file that is shown on the archive page for your post type. archive-property.php. Code Examples. Display a field Retrieving a field as a variable Using conditional statements.

Code Examples

Get_field_object() Query posts by custom fields. Overview This article will demonstrate how to retrieve an array of post objects from the database using native WP functions.

Query posts by custom fields

There are many ways to query posts in WP, however, this article will make use of the common get_posts function, WP_Query Object and pre_get_posts filter. Getting started If you are already familiar with the above function, object and filter you may skip this section. The WP_Query object is used to query posts and will return an object containing an array of $post objects and many useful methods. The get_posts function makes use of the above WP_Query object, however, it only returns an array of $post objects making it a simpler way to find and loop over posts.

The pre_get_post filter is called after the query object is created, but before the actual query is run. Creating a WP archive with custom field filter. Displaying values in your theme. Overview The Advanced Custom Field’s API makes it very easy to display field data in your theme.

Displaying values in your theme

There are many functions available and all are well documented on the resources page. The Basics Once you have created a field group and input some data, you can now load and display the data in your theme. Distributing ACF in a plugin / theme. Overview.

Distributing ACF in a plugin / theme

Remove frontend dependency from ACF. Custom Stylesheet in WordPress with Advanced Custom Fields and the ACF Options Add-On. I absolutely love Advanced Custom Fields and us it for every WordPress based project I develope.

Custom Stylesheet in WordPress with Advanced Custom Fields and the ACF Options Add-On

This, in hand with the Custom Post Types UI plugin really help to flesh out WordPress as a much more complete content management system. With the help of many other WordPress users and Google searches I have been using ACF and the Options add-on to generate custom stylesheets. That way, administrators can easily go into the WordPress Dashboard and modify the look of the site without having to dig into the CSS directly. ACF WYSIWYG Styling « WordPress Plugins.

Do I need to install a plugin to do this?

ACF WYSIWYG Styling « WordPress Plugins

Not at all. For the time being ACF doesn't add these classes to the editor, but you can do it either by installing this plugin or by placing the following code in your functions.php file: function acf_plugin_wysiwyg_styling() { ? Can I change the prefix of the classes added to the editor? Not with this plugin. Advanced Custom Fields Tutorial #1 : Nested Repeater Fields & Restaurant Menus. Menu Customizer Officially Proposed for Merge Into WordPress 4.3. Contributors on the Menu Customizer feature plugin are proposing its inclusion in WordPress 4.3. Nick Halsey posted the Customizer Team’s proposal last night, beginning with a summary of the purpose of moving menu management into the customizer: In the process, we hope to offer an updated design with improved user flow, a mobile-first interface, improved accessibility, rebuild the administration UI from the ground up to be JavaScript-driven, solve long-standing problems with the current implementation, and clarify the purposes and capabilities of the menus feature.

Additionally, Menu Customizer contributes significantly to the long-term goal to move all appearance functionality and, really, everything that could benefit from live previewing, from the admin to the Customizer. Menu management in the customizer is essentially a full replacement of all the capabilities previously housed in the admin. WordPress cannot move forward without making changes and taking risks. How to Add Custom Meta Boxes in WordPress Posts and Post Types.

Just last week, we showed you how to add custom meta fields to custom taxonomies in WordPress. That article brought our attention to another important topic of how to add custom meta boxes in WordPress posts and post types. We wrote about a plugin method of adding meta boxes and custom write panels using More Fields plugin, but the development of that plugin has stopped.

WordPress Custom Post Types using Types Plugin. What is a WordPress Custom Post Type? WordPress custom post types let you add your own data types to the WordPress admin. Out-of-the-box, WordPress comes with pages and posts. If you want to display other types, such as products, testimonials, projects and anything else, the best way is to setup custom post types. This way, different types of content are organized under different menus. You can also control user-access for different types, allowing better management of your site. Creating Custom Content in WordPress: Custom Post Types. It’s pretty much universally agreed now that WordPress is more than just a blogging platform: It’s a Content Management System. But in my view what makes it a powerful CMS is the ability to create custom content and display that content in exactly the way you need to. In this, the first of of two posts I’ll look at the three types of custom content in WordPress and show you how to create that content.

I’ll cover: