1. Go to this page and download the library: Download potterywp/potter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
potterywp / potter example snippets
use Potter\Potter;
$features = Potter::features();
use Potter\Theme\Options;
class ThemeOptions extends Options
{
protected $page_title = 'Opções do Tema';
protected $menu_title = 'Opções do Tema';
protected $settings_id = 'my_theme_options_id';
public function doRegister()
{
}
}
public function doRegister()
{
// Primeiro você cria a seção
$this->addSection('general', 'Geral')
// depois você adcionar as opções, que são automaticamente inseridas na devida seção
->addUpload('logo', 'Logo')
->addText('header_slogan', 'Header Slogan');
$this->addSection('another_section', 'Another')
->addTextArea('text_impact', 'Text impact')
->addPageSelect('my_page_id', 'Select Page');
// Você não é obrigado a encadear os metodos
$this->addSection('more_section', 'GoT');
$this->addCustomPostTypeSelect('my_got_id','Select GoT', 'Desc of select', 'got');
$this->addCategorySelect('my_cat_id','Select GoT', 'Desc of select', 'got');
// As as opções são anexadas automaticamente a última seção configurada.
}
// Retorna um objeto WP_Query
$sliders = \Potter\Potter::model('slider')->all(); // passe como parametro o nome do model/post type que você criou
// Nada muda no seu código
if($query->have_posts()):
while($query->have_posts()): $query->the_post()
///
endwhile;
endif;
// Retorna um objeto Potter/Post/ModelQuery
$slidersQuery = \Potter\Potter::model('slider'); // passe como parametro o nome do model/post type que você criou
// Retorna um objeto WP_Query
$slidersQuery->perPage(15)->order('author')->exclude(99)->exe();
// Retorna um objeto WP_Query
$slidersQuery->perPage(15)->exe();
$slidersQuery->exe($args = array()); // Passe parametros extras diretamente para o WP_Query
$slidersQuery->get(5, $args = array()) // Uma quantidade limitada de resultados
// Retorna um objeto WP_Query
$slidersQuery->perPage(5)->byParent(9) // Páginas filhas do ID 9
$slidersQuery->perPage(5)->exclude(get_the_ID())->byParent(9) // Páginas filhas do ID 9, menos a página atual
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.