Skip to content

Instantly share code, notes, and snippets.

View SuryawanshiPrajakta's full-sized avatar
🎯
Focusing

Prajakta Suryawanshi SuryawanshiPrajakta

🎯
Focusing
  • Brainstorm Force
  • Pune
View GitHub Profile
@SuryawanshiPrajakta
SuryawanshiPrajakta / full-content.txt
Last active June 11, 2020 04:53
Filter to display full content of post instead of excerpt.
1) Enable short excerpt under the Excerpt tab. Here, excerpt length will not make any effect. Refer here - https://cl.ly/f27e6a04fdea
2) Paste this code in your active theme's functions.php file -
add_action('uael_single_post_before_excerpt','custom_post_content',10,2);
function custom_post_content($post_id, $settings){
?>
<div class="uael-post__excerpt uael-custom-excerpt">
<?php the_content(); ?>
</div>
<?php
@SuryawanshiPrajakta
SuryawanshiPrajakta / timeline-icon.txt
Created June 11, 2020 07:18
Change Timeline icon on hover of title
1) Add the below script in active theme's functions.php
function modal_custom_script() {
?>
<script type="text/javascript">
jQuery(function($) {
$('.uael-content').on('mouseover', function(){
$( this ).parents('.uael-day-new').prev('.uael-timeline-marker').addClass('hover');
});
@SuryawanshiPrajakta
SuryawanshiPrajakta / meta.txt
Last active June 11, 2020 07:47
Display meta above title
1) Put the following in the active theme's functions.php
function title_before( $post_id, $settings ) {
?>
<div class="uael-post__meta-data custom">
<span class="uael-post__author"><?php the_author(); ?></span>
<span class="uael-post__date"> <?php echo wp_kses_post( apply_filters( 'uael_post_the_date_format', get_the_date(), get_the_ID(), get_option( 'date_format' ), '', '' ) );
?>
</span>
@SuryawanshiPrajakta
SuryawanshiPrajakta / close-offcanvas.txt
Last active June 24, 2020 11:21
Close Off-Canvas on click of a button
1. Add a custom class to the Button on which you want to close the off-canvas.
Refer - https://cl.ly/f61014b8265b
2. Paste below code in your active Themes Functions.php file -
function offcanvas_custom_script() {
?>
<script type="text/javascript">
jQuery(function($) {
$( '.custom-close-offcanvas' ).click( function () {
var $canvas = $( '.uael-offcanvas-show' ).attr( 'id' );
@SuryawanshiPrajakta
SuryawanshiPrajakta / order-by-custom-field.txt
Last active May 26, 2021 17:28
Order posts by custom field value
1) Create a custom field and attach it to the post type require - https://cl.ly/dc507435d638
2) Add the below code in the active child theme's functions.php file -
add_filter( 'uael_posts_query_args', function( $query, $settings ) {
// Modify the query here
$query = array(
'meta_key' => 'post_order',
'orderby' => 'meta_value',
'order' => 'DESC'
);
@SuryawanshiPrajakta
SuryawanshiPrajakta / parent-categories.txt
Last active June 30, 2020 12:12
Display only parent categories in Taxonomy Badge
Add the following code in active child theme's functions.php
add_filter( 'uael_posts_tax_filter', function( $terms ) {
$parent_terms = array();
$terms = wp_get_post_terms( get_the_ID(), 'category' );
foreach( $terms as $term ){
if( $term->parent == 0 ){
array_push( $parent_terms, $term );
}
@SuryawanshiPrajakta
SuryawanshiPrajakta / child-categories.txt
Created June 30, 2020 12:12
Display only sub-categories in Taxonomy Badge
Add the following filter in your active child theme's functions.php file
add_filter( 'uael_posts_tax_filter', function( $terms ) {
$child_terms = array();
$terms = wp_get_post_terms( get_the_ID(), 'category' );
foreach( $terms as $term ){
if( $term->parent !== 0 ){
array_push( $child_terms, $term );
@SuryawanshiPrajakta
SuryawanshiPrajakta / custom-excerpt.txt
Last active July 11, 2020 05:10
Display custom excerpt
1) Create a textarea field and attach it to page - https://cl.ly/060d1cd4d38b
2) Add text to your textarea field -
3) Add below CSS to hide the default excerpt -
.uael-post__excerpt {
display: none;
}
.custom.uael-post__excerpt {
display: block;
@SuryawanshiPrajakta
SuryawanshiPrajakta / post-video-thumbnail.txt
Created July 11, 2020 06:33
Show video instead of thumbnail
1) Create ACF field - oEmbed and attach to the Posts
2) Add the below code in active child them's functions.php
function single_post_thumb_before( $post_id, $settings ) {
?>
<div class="custom uael-post__thumbnail">
<?php echo get_field( 'posts_video_thumbnail', $post_id ); ?>
</div>
<?php
@SuryawanshiPrajakta
SuryawanshiPrajakta / related-posts.txt
Created July 14, 2020 05:22
Related posts with category