Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂
Happy and peace when coding

Tran Ngoc Tuan Anh rilwis

🙂
Happy and peace when coding
View GitHub Profile
@rilwis
rilwis / page-account.php
Last active Sep 14, 2019 — forked from kutoi94/page-account.php
Page My Account create with MB User Profile Plugin
View page-account.php
<?php
/**
* Template Name: My Account
*/
if ( !is_user_logged_in() ) {
auth_redirect();
}
get_header();
?>
@rilwis
rilwis / meta-box.php
Last active Jul 27, 2019 — forked from kutoi94/Create Post Field in Meta Box Plugin
Create Post Field in Meta Box Plugin
View meta-box.php
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Related Post',
'id' => 'related-post',
'post_types' => array(
0 => 'post',
),
'context' => 'normal',
@rilwis
rilwis / template.php
Last active Aug 16, 2019 — forked from kutoi94/Create Related Posts with Meta Box Plugin
Create Related Posts with Meta Box Plugin
View template.php
<?php
$field_id = 'related_posts';
$related_posts = rwmb_meta( $field_id );
if (isset($related_posts)) { ?>
<div id="relatedPosts" class="related-posts">
<h3 class="related-posts-headline"><em>You might also like</em></h3>
<div class="related-posts-items jp-related-posts-grid">
<?php foreach ($related_posts as $related_post) { ?>
<div class="related-post-item">
<a class="related-post-a" href="<?php echo get_the_permalink($related_post); ?>" title="<?php echo get_the_title($related_post); ?>" rel="nofollow">
@rilwis
rilwis / template.php
Created Jul 15, 2019 — forked from kutoi94/Meta Box Plugin
Use Meta Box to build the product detail page
View template.php
<div class="page-wrapper">
<div class="product-gallery--columns-4 images" data-columns="4">
<figure class="product-gallery__wrapper">
<a href="<?php echo get_the_post_thumbnail('full'); ?>">
<img src="<?php echo get_the_post_thumbnail('full'); ?>" alt="<?php the_title(); ?>">
</a>
<div class="thumbnails owl-carousel owl-loaded owl-drag">
<div class="owl-stage-outer">
<div class="owl-stage">
<div class="owl-item">
@rilwis
rilwis / meta-box.php
Last active Jul 15, 2019 — forked from kutoi94/Meta Box Plugin
Create custom field in product details page by meta box plugin
View meta-box.php
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Car Rental',
'id' => 'car-rental',
'post_types' => array(
0 => 'car-rental',
),
'context' => 'normal',
@rilwis
rilwis / flexible-content-field-by-meta-box.php
Last active Jun 9, 2019 — forked from kutoi94/flexible-by-meta-box
Create ACF Flexible Field with Meta Box Plugin
View flexible-content-field-by-meta-box.php
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Flexible Field Example',
'post_types' => 'page',
'fields' => array(
array (
'id' => 'sections',
'type' => 'group',
@rilwis
rilwis / functions.php
Last active Oct 29, 2018
Optimize BB for loading
View functions.php
<?php
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'font-awesome' );
wp_dequeue_script( 'jquery-magnificpopup' );
wp_dequeue_style( 'jquery-magnificpopup' );
wp_dequeue_script( 'jquery-waypoints' );
wp_dequeue_script( 'imagesloaded' );
wp_dequeue_script( 'jquery-throttle' );
@rilwis
rilwis / functions.php
Last active Apr 13, 2019
Create Landing Page With Custom Fields
View functions.php
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
$meta_boxes[] = array(
'title' => 'Section Hero',
'post_types' => 'page',
'fields' => array(
array(
'id' => 'hero_title',
'name' => 'Title',
'type' => 'text',
@rilwis
rilwis / clone-group-inherit-values.php
Created Nov 13, 2017
Cloneable group inheriting values from previous group
View clone-group-inherit-values.php
<?php
$meta_boxes[] = array(
'title' => __( 'Content blocks' ),
'post_types' => 'page',
'fields' => array(
array(
'id' => 'content-block',
'type' => 'group',
'clone' => true,
'sort_clone' => true,
@rilwis
rilwis / demo.php
Created Apr 17, 2017
Hierarchical select/checkbox_list
View demo.php
<?php
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
$meta_boxes[] = array(
'title' => 'Test',
'fields' => array(
array(
'type' => 'select_tree', // or checkbox_list
'id' => 'cb',
'name' => 'Hierarchical checkboxes',
'options' => array(
You can’t perform that action at this time.