Skip to content

Instantly share code, notes, and snippets.

View dospuntocero's full-sized avatar

Francisco arenas dospuntocero

View GitHub Profile
@dospuntocero
dospuntocero / gh-pages-deploy.md
Created January 26, 2020 19:16 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

<?php
namespace Roots\Sage\Nav;
use Roots\Sage\Utils;
/**
* Cleaner walker for wp_nav_menu()
*
* Walker_Nav_Menu (WordPress default) example output:
@dospuntocero
dospuntocero / super-clean-wp-menu.php
Last active January 4, 2020 11:06
from time to time you need to completely change the way a menu markup is displayed and the walker class is a pain. you can just use this procedural function and add classes or markup you need
function clean_custom_menus() {
$menu_name = 'nav-primary'; // specify custom menu slug
if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
$menu = wp_get_nav_menu_object($locations[$menu_name]);
$menu_items = wp_get_nav_menu_items($menu->term_id);
$menu_list = '<nav>';
$menu_list .= '<ul>';
foreach ((array) $menu_items as $key => $menu_item) {
$title = $menu_item->title;
@dospuntocero
dospuntocero / childmenu.php
Created December 18, 2019 23:04
child menu with current class using sage roots
public function childMenu() {
global $post;
// Set up the objects needed
$childQuery = new \WP_Query();
$pages = $childQuery->query(array('post_type' => 'page', 'posts_per_page' => '-1'));
if ( is_page() && $post->post_parent ){
$childpages = get_page_children( $post->post_parent, $pages);
}
else{
@dospuntocero
dospuntocero / instructions.md
Created December 2, 2019 21:26
Disabling StyleLint on Sage 9

#The Problem You receive a ton of “Expected indentation” or “Expected empty line before rule” messages when yarn compiles your code when using Sage 9.

#The Solution Just turn Style Lint off. Locate the webpack.config.js and comment out the following code…

// new StyleLintPlugin({ // failOnError: !config.enabled.watcher, // syntax: 'scss', // }),

@dospuntocero
dospuntocero / remove-all-products.sql
Created November 11, 2019 23:11
remove all products from woocommerce database
DELETE relations.*, taxes.*, terms.*
FROM wp_term_relationships AS relations
INNER JOIN wp_term_taxonomy AS taxes
ON relations.term_taxonomy_id=taxes.term_taxonomy_id
INNER JOIN wp_terms AS terms
ON taxes.term_id=terms.term_id
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product');
DELETE FROM wp_posts WHERE post_type = 'product';
@dospuntocero
dospuntocero / remove-wh.php
Created October 18, 2019 20:25
remove width and height from wordpress images
add_filter( 'post_thumbnail_html', 'remove_wps_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_wps_width_attribute', 10 );
function remove_wps_width_attribute( $html ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
@dospuntocero
dospuntocero / gsap.css
Created October 1, 2019 02:43
gsap slideUp/slideDown functionality
body{
background-color:black;
height:100%;
margin:10px;
}
.box{
position:relative;
@dospuntocero
dospuntocero / faq.html
Last active September 20, 2019 21:48
simplest faq accordion
<div class="question">Vad gör jag om jag vill låna mer än 2 miljoner?</div>
<div class="answer">Vi på Corpia hjälper dagligen företag att nå sina visioner och mål genom att hitta rätt finansiering för rätt behov, både på vår digitala marknadsplats och utanför. I dagsläget har vi ingen möjlighet att hantera lån större än 2 miljoner på marknadsplatsen, behöver ditt företag ett större lån än så kan du höra av dig till David, eller läsa mer på corpiagroup.se.</div>
<div class="question">Är det säkert att ansöka om lån hos Corpia?</div>
<div class="answer">Er säkerhet är av yttersta vikt för oss. Corpia står under Finansinspektionen tillsyn och behandlar alla uppgifter med full sekretess. Dessutom sker alla betalningsflöden från klientmedelskonton vilket säkerställer att inga likvida medel blandas mellan låntagare, investerare och Corpia.</div>
@dospuntocero
dospuntocero / faq.html
Created September 20, 2019 21:45
simplest faq accordion
<div class="question">Vad gör jag om jag vill låna mer än 2 miljoner?</div>
<div class="answer">Vi på Corpia hjälper dagligen företag att nå sina visioner och mål genom att hitta rätt finansiering för rätt behov, både på vår digitala marknadsplats och utanför. I dagsläget har vi ingen möjlighet att hantera lån större än 2 miljoner på marknadsplatsen, behöver ditt företag ett större lån än så kan du höra av dig till David, eller läsa mer på corpiagroup.se.</div>
<div class="question">Är det säkert att ansöka om lån hos Corpia?</div>
<div class="answer">Er säkerhet är av yttersta vikt för oss. Corpia står under Finansinspektionen tillsyn och behandlar alla uppgifter med full sekretess. Dessutom sker alla betalningsflöden från klientmedelskonton vilket säkerställer att inga likvida medel blandas mellan låntagare, investerare och Corpia.</div>