Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nikhil Nikschavan

🎯
Focusing
View GitHub Profile
@Nikschavan
Nikschavan / change-post-type-label.php
Last active Aug 8, 2018
Change label of a post type in WordPress using filter.
View change-post-type-label.php
<?php // don't copy this line in your code
function your_prefix_change_post_type_slug( $args, $post_type ) {
if ( 'sfwd-topic' == $post_type ) {
$args['labels']['name'] = 'LD Topics';
}
return $args;
}
@Nikschavan
Nikschavan / woocommerce-product-gallery-thumbnails-dimensions.php
Created Jul 27, 2018
Change WooCommerce product gallery image thumbnail dimensions
View woocommerce-product-gallery-thumbnails-dimensions.php
@Nikschavan
Nikschavan / disable-post-navigation.php
Created Jun 4, 2018
Astra - Disable Next/Previous post navigation for specific post type
View disable-post-navigation.php
<?php // don't copy this line in your code.
/**
* Disable Next/Previous post links on specific post ttype.
* Change `your-post-type` to your post-type slug.
*
* @param Boolean $status true - If the navigation is displayed. False - If navigation is disabled.
* @return Boolean $status true - If the navigation is displayed. False - If navigation is disabled.
*/
function your_prefix_next_prev_links( $status ) {
@Nikschavan
Nikschavan / astra-disable-featured-image-on-all-pages.php
Last active May 18, 2018
Disable featured images on all pages - Astra WordPress Theme
View astra-disable-featured-image-on-all-pages.php
@Nikschavan
Nikschavan / astra-disable-title-on-all-pages.php
Last active May 18, 2018
Disable title on all pages - Astra WordPress Theme
View astra-disable-title-on-all-pages.php
<?php // don't copy this line in your code
/**
* Disable title on all post types.
*/
function your_prefix_post_title() {
$post_types = array(
'post',
'page',
@Nikschavan
Nikschavan / dynamic-astra-customizer-options-update.php
Last active May 16, 2018
Astra Theme - Add 'Apply Now` button in the Header conditionally with a link to page with a form to apply.
View dynamic-astra-customizer-options-update.php
<?php // don't copy this line in your file.
// Condition to check if this page requires `Apply Now` button.
if ( 1481 === get_the_id() ) {
your_prefix_setup_header_button_apply_now();
}
/**
* Setup filters for changing the values in the Astra Settings.
*/
@Nikschavan
Nikschavan / astra-align-footer-always-bottom-of-page.php
Last active May 16, 2018
Align the footer always in at the bottom of the page even if the page content is less.
View astra-align-footer-always-bottom-of-page.php
View smooth-scroll-to-anchor.js
jQuery(document).on('ready', function(event) {
// Scroll smoothly to anchor
jQuery('a[href^="#"]').on('click', function(event) {
var target = jQuery(this.getAttribute('href'));
if( target.length ) {
event.preventDefault();
jQuery('html, body').stop().animate({
scrollTop: target.offset().top
}, 1000);
@Nikschavan
Nikschavan / astra-sidebar-before-content.css
Created Apr 2, 2018
Astra Theme - Move the sidebar before the content on mobile
View astra-sidebar-before-content.css
@media (max-width: 768px) {
#primary {
order: 2;
}
#secondary {
order: 1;
}
.ast-container {
@Nikschavan
Nikschavan / astra-sidebar-before-content.css
Created Apr 2, 2018
Astra Theme - Move the sidebar before the content on mobile
View astra-sidebar-before-content.css
@media (max-width: 768px) {
#primary {
order: 2;
}
#secondary {
order: 1;
}
.ast-container {
You can’t perform that action at this time.