Skip to content

Instantly share code, notes, and snippets.

Avatar

Angga Permana permanart

View GitHub Profile
@permanart
permanart / functions.php
Created Oct 13, 2021
Show multiple ads within paragraph wordpress
View functions.php
//Insert ads after n paragraph multiple ads
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code1 = '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5327211893729632"
crossorigin="anonymous"></script>
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-xxxxxxxxxxxxxxx"
@permanart
permanart / functions.php
Created Dec 14, 2020
Remove WordPress Admin Menu
View functions.php
/**
* Removes some menus by page.
*/
function dinoiki_remove_menus(){
remove_menu_page( 'index.php' ); //Remove Dashboard
remove_menu_page( 'jetpack' ); //Remove Jetpack
remove_menu_page( 'edit.php' ); //Remove Posts
remove_menu_page( 'upload.php' ); //Remove Media
remove_menu_page( 'edit.php?post_type=page' ); //Remove Pages
@permanart
permanart / functions.php
Created Dec 14, 2020
Auto Open Coupon Field WooCommerce
View functions.php
add_action( 'wp_footer', 'woocommerce_show_coupon', 99 );
function woocommerce_show_coupon() {
echo '
<script type="text/javascript">
jQuery(document).ready(function($) {
$(\'.checkout_coupon\').show();
});
</script>
';
}
@permanart
permanart / functions.php
Created Dec 14, 2020
Create Verified Author WordPress with user Role
View functions.php
function add_verification_bagdge_to_authors($display_name) {
global $authordata;
if (!is_object($authordata))
return $display_name;
$icon_roles = array(
'administrator',
'editor',
'your-custom-role',
@permanart
permanart / functions.php
Created Dec 14, 2020
Create custom tabs Buddypress
View functions.php
function yourtab_content() {
get_header( vibe_get_header() );
if ( !defined( 'ABSPATH' ) ) exit;
$user_id=get_current_user_id();
if(function_exists('bp_course_get_current_user_id')){
$user_id=bp_course_get_current_user_id();
}