This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*=================================== | |
= Posts Types = | |
===================================*/ | |
/*========== Exemplo ==========*/ | |
function exemplo() { | |
$args = array( | |
'labels' => array('name' => 'exemplo', 'add_new' => 'Adicionar'), | |
'public' => true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define( 'PLUGIN_PATH', plugin_dir_path(__FILE__)); | |
add_action('template_redirect', 'load_template_pluginname'); | |
function load_template_pluginname(){ | |
global $post; | |
if(get_post_meta($post->ID, 'pluginname_page', true)){ | |
if(locate_template('template-plugin-name.php', false) == ""){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
var custom_uploader; | |
$('#upload_image_button').click(function(e) { | |
e.preventDefault(); | |
if (custom_uploader) { | |
custom_uploader.open(); | |
return; | |
} | |
custom_uploader = wp.media.frames.file_frame = wp.media({ | |
title: 'Escolha a imagem para o banner', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ob_start(); | |
include 'secondfile.php'; | |
$myvar = ob_get_clean(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create a new custom yoast seo sitemap | |
*/ | |
add_filter( 'wpseo_sitemap_index', 'ex_add_sitemap_custom_items' ); | |
add_action( 'init', 'init_wpseo_do_sitemap_actions' ); | |
// Add custom index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*************************************************************************** | |
Plugin Name: Meu Plugin | |
Plugin URI: https://www.meuplugin.com/ | |
Description: Plugin base para iniciar o desenvolvimento | |
Version: 1.0 | |
Author: Claudio Web (claudioweb) | |
Author URI: http://www.claudioweb.com.br/ | |
Text Domain: meu-plugin | |
**************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fields_layout = array(); // irá armazenar os fields do layout | |
if (have_rows('layout_campo_nome',$post_id)) { | |
// nome_do_campo tipo layout com o post_id | |
while (have_rows('layout_campo_nome',$post_id)) { | |
the_row(); | |
// layout e seus fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
get_field('nome_do_campo',$id_post); // id do POST | |
get_field('nome_do_campo','user_'.$id_user); // id do usuário | |
get_field('nome_do_campo', 'options'); // campo registrado como opção | |
?> |
OlderNewer