Skip to content

Instantly share code, notes, and snippets.

View joychetry's full-sized avatar
🏠
Working from home

Joy Chetry joychetry

🏠
Working from home
View GitHub Profile
@joychetry
joychetry / functions.php
Created April 5, 2020 14:41
Yoast to Excerpt Using Shortcode
/*START Yoast to Excerpt*/
add_shortcode( 'crowwwn_ymeta', 'get_yoast_meta' );
function get_yoast_meta() {
$yoast_meta = get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true);
if ($yoast_meta == !NULL) {
echo $yoast_meta;
}
else {
$content = get_the_content();
echo wp_trim_words( $content , '27' );
@joychetry
joychetry / functions.php
Created April 5, 2020 14:52
Remove Update and Deactivate Plugin Options
// Removing plugin controls from admin
function remove_plugin_controls($actions, $plugin_file, $plugin_data, $context){
if (array_key_exists('edit', $actions)) {
unset($actions['edit']);
}
if (array_key_exists('deactivate', $actions)) {
unset($actions['deactivate']);
@joychetry
joychetry / functions.php
Created April 5, 2020 18:19
Remove Plugin Update Notifications
/*START Remove Plugin Update Notifications */
function remove_update_notifications( $value ) {
if ( isset( $value ) && is_object( $value ) ) {
unset( $value->response[ 'plugin1/plugin1.php' ] );
unset( $value->response[ 'plugin2/plugin2.php' ] );
unset( $value->response[ 'plugin3/plugin3.php' ] );
}
return $value;
@joychetry
joychetry / functions.php
Created April 5, 2020 18:23
Enable SVG Upload in WP
function upload_svg_files( $allowed ) {
if ( !current_user_can( 'manage_options' ) )
return $allowed;
$allowed['svg'] = 'image/svg+xml';
return $allowed;
}
add_filter( 'upload_mimes', 'upload_svg_files');
@joychetry
joychetry / functions.php
Last active April 5, 2020 19:09
Replace Default Post Excerpt to Yoast using Filter
add_filter( 'get_the_excerpt', 'replace_post_excerpt_crowwwn' );
function replace_post_excerpt_crowwwn($output)
{
$output=get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true);
if ($output == !NULL) {
return $output;
}
else {
$content = get_the_content();
return wp_trim_words( $content , '27' );
@joychetry
joychetry / htmlwidget
Created April 12, 2020 20:12
Hide Sticky Header on Scroll Down / Show on Scroll Up Elementor
//Set Element ID to "stickycrowwwn"
<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
var mywindow = $(window);
var mypos = mywindow.scrollTop();
mywindow.scroll(function() {
if (mypos > 40) {
if(mywindow.scrollTop() > mypos) {
@joychetry
joychetry / elementor-css
Last active April 20, 2020 12:04
Responsive 100% Columns Alignment in Elementor
/* Quick Use */
/* Section */
selector .elementor-container .elementor-row {
flex-wrap: wrap;
}
/* Column */
selector {
width: 100%;
}
@joychetry
joychetry / elementor.css
Last active April 26, 2020 05:33
Consistent Image Size
selector .elementor-image img {
border-radius: 10px 10px 10px 10px;
width: 400px;
height: 235px;
max-width: 100%;
object-fit: cover;
overflow: hidden;
}
@joychetry
joychetry / media-query.css
Created April 26, 2020 06:53 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@joychetry
joychetry / footer.php
Created May 13, 2020 14:25
Open External Links on New Tab