Skip to content

Instantly share code, notes, and snippets.

Nicolas Joly dotMastaz

Block or report user

Report or block dotMastaz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wordpress cpt 404 redirect
add_action( 'template_redirect', 'cpt_404_redirect' );
function cpt_404_redirect()
{
if( is_404()) {
global $wp_query;
if ( isset( $wp_query->query['post_type'] ) && $wp_query->query['post_type'] == 'cpt_slug' ) {
wp_redirect( home_url( '/your-url/' ) );
exit();
}
}
@dotMastaz
dotMastaz / functions.php
Created Mar 28, 2017
WordPress (v4.7.3) : GeoMyWP (v2.7) no result issue when PolyLang (2.1.2) is actived : Fixed with this...
View functions.php
function gmw_polylang_remove_query_var( $args ) {
foreach( $args->query_vars['tax_query'] as $key => $value ) {
if ( $value['taxonomy'] == 'language' ) {
unset( $args->query_vars['tax_query'][$key] );
}
}
View docker-commands.txt
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Start all stopped containers
docker start $(docker ps -a -q)
@dotMastaz
dotMastaz / Adding Support for Gmail
Created Nov 10, 2016
Responsive Rollover Images for Email
View Adding Support for Gmail
<!DOCTYPE>
<html>
<head>
<style>
.rollover:hover > img,
* [summary=rollover]:hover > img{
max-height: 0px !important;
}
.rollover:hover > div img,
* [summary=rollover]:hover > div img{
@dotMastaz
dotMastaz / CSS to HEAD TAG
Created Nov 10, 2016
Rollover Image for Email
View CSS to HEAD TAG
<style>
.rollover:hover > img,
* [summary=rollover]:hover > img { max-height: 0px !important; }
.rollover:hover > div img,
* [summary=rollover]:hover > div img{ max-height: none !important; }
</style>
@dotMastaz
dotMastaz / CSS
Created Nov 10, 2016
Image Carousel for Email
View CSS
<style>
input{
display: none;
}
@media screen and (max-width:9999px){
.cboxcheck:checked + * .thumb-carousel,
* [summary=cboxcheck]:checked + * [summary^=thumb-carousel] {
height: auto !important;
max-height: none !important;
line-height:0;
View dabblet.css
/* Checkbox Hack */
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
label {
-webkit-appearance: push-button;
-moz-appearance: button;
@dotMastaz
dotMastaz / wp_post_title_require
Created May 5, 2015
WordPress Post Title Require
View wp_post_title_require
function post_title_require($title='') {
if ( '' == $title )
die('Post Title Require');
return $title;
}
add_filter('title_save_pre', 'post_title_require', 0);
View jQuery Find Text and Replace.js
//Find Text and Replace
$("selector").text(function () {
return $(this).text().replace("search", "replace");
})
View prestashop get cms content.php
/* example 1 */
/* In controller */
global $cookie;
global $smarty;
$cms = new CMS(1, intval($cookie->id_lang));
if (Validate::isLoadedObject($cms))
$smarty->assign('content', $cms->content);
/* In .tpl */
You can’t perform that action at this time.