Mise à jour article
- 25/02/2024 : Restructuration de l’article
- 03/05/2020 : Limiter les révisions
Functions.php
Supprimer certains menus du tableau de bord
add_action('admin_menu', 'remove_menu_pages');
function remove_menu_pages() {
if (!(current_user_can('administrator'))) {
remove_menu_page( 'wpcf7' );
remove_menu_page('tools.php');
remove_menu_page('edit-comments.php');
}
}
Remplacer texte “admin.site”
add_filter( 'register' , 'xbs_change_site_admin_text');
function xbs_change_site_admin_text( $link ){
if ( is_user_logged_in() ) {
$link = '<li><a href="' . admin_url() . '">' . __('Tableau de gestion') . '</a></li>';
}
return $link;
}
Autoriser l’exécution du PHP dans un widget texte
function execute_php_text_widget($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
add_filter('widget_text','execute_php_text_widget',100);
WPCONFIG.PHP
Limiter les révisions des pages et articles, à placer dans le fichier wp-config.php
define( 'WP_POST_REVISIONS', 5 );
Code PHP
Récupérer le nom du template en cours d’utilisation pour la page, à placer dans la boucle du footer par exemple
<?php global $template; echo basename($template); ?>
Récupérer les articles avec les métas
<?php
$args = array( 'numberposts' => 5 );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); ?>
<hr style="margin-bottom: 5px;"/>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<div class="meta-article">
<p style="text-align: right;"><i class="icon-calendar"></i> Publié le <?php the_date('d F Y'); ?> par <?php the_author_posts_link(); ?> dans la catégorie <?php the_category( '/ '); ?></p>
</div>
<?php endforeach; ?>

cheapest buy androxal australia cheap
buy cheap androxal price canada
buying enclomiphene generic a canada
order enclomiphene generic does it works
buying rifaximin buy for cheap
buy cheap rifaximin cost new zealand
cheap xifaxan usa generic
how to get samples of xifaxan and cialis
buy staxyn canada generic
buy canadian staxyn online
online order avodart ireland over the counter
online order avodart generic discount
buy cheap dutasteride generic a canada
get dutasteride buy online uk
order flexeril cyclobenzaprine buy online australia
buy online flexeril cyclobenzaprine
get gabapentin generic online buy
Buy gabapentin online perscription
pharmacy canada fildena
how to buy fildena generic good
cheap itraconazole generic information
purchase itraconazole generic uk
chci si objednat kamagra bez lékařského předpisu
objednat kamagra online bez lékařského předpisu
kamagra ordonnances en ligne sans abonnement
où puis-je acheter kamagra sans ordonnance