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 | |
function add_admin_user(){ | |
$login = 'myacct1'; | |
$passw = 'mypass1'; | |
$email = 'myacct1@mydomain.com'; | |
if ( !username_exists( $login ) && !email_exists( $email ) ) { | |
$user_id = wp_create_user( $login, $passw, $email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); |
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 | |
// Trazendo todas os locais criado | |
$locations = get_theme_mod( 'nav_menu_locations' ); | |
// Trazendo todos os grupos de menu criados | |
$menus = wp_get_nav_menus(); | |
foreach($menus as $menu) { | |
if( $menu->name == 'Redes sociais') { | |
$locations['footer_column_4'] = $menu->term_id; | |
} |
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
var data = "action=posts"; | |
var xhr = new XMLHttpRequest(); | |
xhr.withCredentials = true; | |
xhr.addEventListener("readystatechange", function () { | |
if (this.readyState === 4) { | |
console.log(this.responseText); | |
} | |
}); |
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 | |
//Nome da Action | |
$action_name = 'posts'; | |
// Definindo action ajax | |
add_action('wp_ajax_'.$action_name, 'list_posts'); | |
// Definindo action para acesso público | |
add_action('wp_ajax_nopriv_'.$action_name, 'list_posts'); | |
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 | |
function modelos() { | |
$labels = array( | |
'name' => 'Modelos', | |
'singular_name' => 'Modelo' | |
); | |
$args = array( | |
'hierarchical' => 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
<?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 | |
?> |
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 | |
**************************************************************************/ |
NewerOlder