Skip to content

Instantly share code, notes, and snippets.

View amanhstu's full-sized avatar

Amanur Rahman amanhstu

View GitHub Profile
<?php
/*
* Plugin Name: AmanHstu Video Widget
* Author: Amanur Rahman
* Author URI: http://www.ahsanurrahman.com
* Plugin URI: http://www.ahsanurrahman.com
* Description: This will show a video widget in widget section
* Version: 1.0
*/
<?php
$post_object = get_field('field');
if($post_object) :
$post = $post_object;
// Overwrite $post
setup_postdata( $post ); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php
// Reset $post so the rest of the page works
wp_reset_postdata();
<?php echo substr(apply_filters( ‘woocommerce_short_description’, $post->post_excerpt ),0,230).’ …’; ?>
<?php
function remove_admin_menu_items() {
$remove_menu_items = array(__('Links'));
global $menu;
end ($menu);
while (prev($menu)){
$item = explode(' ',$menu[key($menu)][0]);
if(in_array($item[0] != NULL?$item[0]:"" , $remove_menu_items)){
unset($menu[key($menu)]);}
}
<?php
function wpb_author_info_box( $content ) {
global $post;
// Detect if it is a single post with a post author
if ( is_single() && isset( $post->post_author ) ) {
// Get author's display name
$display_name = get_the_author_meta( 'display_name', $post->post_author );
.author_bio_section{
background: none repeat scroll 0 0 #F5F5F5;
padding: 15px;
border: 1px solid #ccc;
}
.author_name{
font-size:16px;
font-weight: bold;
}
<?php while ( have_posts() ) : the_post(); ?>
<div class="main-content">
<div class="main-wrap">
<div class="col-sm-12">
<div class="breadcrumbs">
<?php if(function_exists('bcn_display')) { bcn_display(); }?>
</div> <!-- breadcrambs ends here -->
</div><!-- col-sm-12 ends here -->
<?php // check for rows (parent repeater)
if( have_rows('product_page') ): ?>
<?php // Advanced custom fields repeater
if(get_field('repeater_field_name')): ?>
<ul>
<?php while(has_sub_field('repeater_field_name')): ?>
<li>sub_field_1 = <?php the_sub_field('sub_field_1'); ?>, sub_field_2 = <?php the_sub_field('sub_field_2'); ?>, etc</li>
<?php endwhile; ?>
</ul>
<?php// check if the repeater field has rows of data
if( have_rows('repeater_field_name') ): // loop through the rows of data
while ( have_rows('repeater_field_name') ) : the_row(); // display a sub field value
the_sub_field('sub_field_name');
endwhile;
else : // no rows foundendif;
?>