Skip to content

Instantly share code, notes, and snippets.

@navalon
navalon / CodigoV2.js
Created October 24, 2023 08:53
Aliexpress To WooCommerce V2
function main() {
const matchingFile = findFileByPattern();
if (matchingFile) {
const excelFileId = importExcelToSheet(matchingFile);
}
}
function findFileByPattern() {
const folderId = '1f1fi3NA7JTw0OlRjBnmaxi-XrwvoQgK0';
const folder = DriveApp.getFolderById(folderId);
@navalon
navalon / functions.php
Created October 29, 2016 01:10 — forked from srikat/functions.php
How to display a list of CPT entries below single CPT pages in Genesis.
// Display Posts Shortcode below the content on single 'kbitem' CPT entries
add_action( 'genesis_after_loop', 'sk_display_more_entries' );
function sk_display_more_entries() {
if ( ! is_singular( 'kbitem' ) ) {
return;
}
echo do_shortcode( '[display-posts post_type="kbitem" posts_per_page="5" title="More Knowledge Base Items"]' );
@navalon
navalon / functions.php
Created October 29, 2016 01:09 — forked from srikat/functions.php
How to reposition Primary Navigation conditionally in Genesis. https://sridharkatakam.com/how-to-reposition-primary-navigation-conditionally-in-genesis/
<?php
// Reposition the primary navigation menu conditionally
add_action( 'genesis_before', 'sk_resposition_primary_nav' );
function sk_resposition_primary_nav() {
// if we are not on a single Post page or archive page or search results page, abort.
if ( ! ( is_singular( 'post' ) || is_archive() || is_search() ) ) {
return;
}
@navalon
navalon / functions.php
Created October 29, 2016 01:09 — forked from srikat/functions.php
How to truncate alt text for featured images on content archives in Genesis. https://sridharkatakam.com/how-to-truncate-alt-text-for-featured-images-on-content-archives-in-genesis/
// Function to truncate post titles
function customTitle( $limit ) {
$title = get_the_title( $post->ID );
if ( strlen( $title ) > $limit ) {
$title = substr( $title, 0, $limit ) . '...';
}
return $title;
@media only screen and (max-width: 860px) {
#front-page-3 .widget-area a.button {
padding: 12px 15px;
}
}
@navalon
navalon / functions.php
Created October 29, 2016 01:07 — forked from srikat/functions.php
How to show breadcrumbs only on full width content pages in Genesis. https://sridharkatakam.com/how-to-show-breadcrumbs-only-on-full-width-content-pages-in-genesis/
// Show breadcrumbs (if enabled in Genesis theme settings) only on full-width-content pages
add_action( 'genesis_before_content', 'sk_conditional_breadcrumbs' );
function sk_conditional_breadcrumbs() {
// get the page layout
$site_layout = genesis_site_layout();
// if the page uses full-width-content layout, abort.
if ( 'full-width-content' == $site_layout ) {
return;
@navalon
navalon / functions.php
Created October 29, 2016 01:06 — forked from srikat/functions.php
How to add an inline mobile responsive menu in Genesis Sample. https://sridharkatakam.com/add-inline-mobile-responsive-menu-genesis-sample/
// Remove site description
add_filter( 'genesis_attr_site-description', 'abte_add_site_description_class' );
/**
* Add class for screen readers to site description.
*
* Unhook this if you'd like to show the site description.
*
* @since 1.0.0
*
* @param array $attributes Existing HTML attributes for site description element.
@navalon
navalon / functions.php
Created October 29, 2016 01:05 — forked from srikat/functions.php
How to get rid of image logo in Genesis. https://sridharkatakam.com/get-rid-image-logo-genesis/
// Removes 'header-image' class from the body_class array
add_filter( 'body_class', 'remove_class' );
function remove_class( $classes ) {
// search the array for the class to remove
$unset_key = array_search( 'header-image', $classes );
if ( false !== $unset_key ) {
// unsets the class if the key exists
unset( $classes[$unset_key] );
@navalon
navalon / functions.php
Created October 29, 2016 01:04 — forked from srikat/functions.php
How to add Page slug as a body class for static Pages in WordPress. https://sridharkatakam.com/add-page-slug-body-class-static-pages-wordpress/
add_filter( 'body_class', 'sk_body_class_for_pages' );
/**
* Adds a css class to the body element
*
* @param array $classes the current body classes
* @return array $classes modified classes
*/
function sk_body_class_for_pages( $classes ) {
if ( is_singular( 'page' ) ) {
@navalon
navalon / genesis-boilerplate.php
Created October 29, 2016 01:04 — forked from srikat/genesis-boilerplate.php
Template for a Genesis specific plugin
<?php
/**
* Plugin Name: Genesis Boilerplate
* Plugin URI: http://example.com/
* Description: Write what the plugin does. Must be using the Genesis theme.
* Author: Your Name
* Author URI: http://example.com/
* Version: 1.0
* Text Domain: genesis-boilerplate
*