Skip to content

Instantly share code, notes, and snippets.

View dospuntocero's full-sized avatar

Francisco arenas dospuntocero

View GitHub Profile
@dospuntocero
dospuntocero / recover lubuntu passwd
Created June 21, 2017 20:05
recover lubuntu passwd
Then you want to type
mount -o rw,remount /
then for the purposes of lost username type
ls /home
be aware that is a lower case L then s its not an i, this will then give you the username associated with the admin account. Now to reset the password.
@dospuntocero
dospuntocero / How to create a Custom Post type template that uses a divi layout directly
Last active May 31, 2019 02:13
How to create a Custom Post type template that uses a divi layout directly
## first in your functions.php add the following:
```
//Shortcode to show the module
function showmodule_shortcode($moduleid) {
extract( shortcode_atts( array('id' =>'*'), $moduleid ) );
return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
}
add_shortcode('showmodule', 'showmodule_shortcode');
```
## then create your single-customCPT.php file duplicating page.php from divi and look for line 45 :
@dospuntocero
dospuntocero / get-vw-mixin.scss
Created June 27, 2017 01:39
when you need to calculate measurements in vw, you need a context (starting point to define what will be 1vw) after that you pass the amount in pixels you want to convert to vws.
$context:960;// size you want to start calculating
@function get-vw($target) {
$vw-context: ($context * .01) * 1px;
@return ($target/$vw-context) * 1vw;
}
//usage
.page-obituary{
h1{
color: #2b6295;
@dospuntocero
dospuntocero / get_template_part_extra()
Last active June 12, 2019 03:10
wordpress get_template_part_extra() lets you pass an array of variables to the template
<?php //called like this on other template get_template_part_extra('templates/products_accordion',[ 'key'=>'protection'] ); ?>
//inside the partial...
<h2>
<?php echo( $template_args['key'] ); ?>
</h2>
@dospuntocero
dospuntocero / example.css
Created November 1, 2017 02:43
use jquery to test for changed css property and make responsive changes. instead of checking on browser width
//The CSS
.tocheck {float:left;}
@media only screen and (max-width: 800px){
.tocheck {float:none;}
}
@dospuntocero
dospuntocero / wordpress menu without container and ul tags
Last active May 31, 2019 02:05
wordpress menu without container and ul tags. useful if you want to hardcode extra items outside wordpress (for example a login for an external system)
<?php
if (has_nav_menu('primary_navigation')) :
wp_nav_menu([
'theme_location' => 'primary_navigation',
'menu_class' => 'nav',
'items_wrap' => '%3$s',
'container' => false
]);
endif;
?>
@dospuntocero
dospuntocero / wordpress multiple loop - group results
Last active March 23, 2020 16:12
looping through a custom post type and its taxonomy. showing results by taxonomy term
<?php
$custom_post_type = 'team_profiles;
$tax_term = 'department';
$terms = get_terms($tax_term);
foreach($terms as $term) :
?>
<h2><?= $term->name;?></h2>
<?php
$cat_posts_args = array(
'post_type' => $custom_post_type,
@dospuntocero
dospuntocero / next previous URLs wordpress
Last active January 12, 2018 02:26
get only the next and prev URL instead of full anchor. useful when you need extensive markup styling
<?php
$prev = get_permalink(get_adjacent_post(false,'',false));
$next = get_permalink(get_adjacent_post(false,'',true));
?>
<a href="<?php echo $prev; ?>">Previous Post</a>
<a href="<?php echo $next; ?>">Next Post</a>
<?php //What if there isn’t a previous or next post? ?>
@dospuntocero
dospuntocero / How to switch to a different remote branch in git Ask Question
Last active May 31, 2019 02:12
How to switch to a different remote branch in git Ask Question
first, just input following command in the terminal:
git branch --all
And then you will see the all the branches on local and remote. Something like this:
*master
remotes/origin/develop
remotes/origin/master
remotes/origin/web
remotes/origin/app
@dospuntocero
dospuntocero / vwvh-conversion.scss
Created February 9, 2018 19:09
//px 2 vw - vh conversion tool
@function get-vw($object_width,$window_width:1440) {
$vw: ($window_width * 0.01) * 1px;
@return ($object_width / $vw) * 1vw;
}
@function get-vh($object_height,$window_height:768) {
$vh: ($window_height * 0.01) * 1px;
@return ($object_height / $vh) * 1vh;
}