Skip to content

Instantly share code, notes, and snippets.

@erlementovich
erlementovich / MonthQuery.php
Created October 13, 2021 12:12 — forked from lufias/MonthQuery.php
Laravel eloquent example to query previous month
<?php
// Previous month
return Model::where('created_at', '>=', Carbon::now()->startOfMonth()->subMonth())
->where('created_at', '<=', Carbon::now()->startOfMonth()->subMonth()->endOfMonth())
->get();
// Current Month
return Model::where('created_at', '>=', Carbon::now()->startOfMonth()
@erlementovich
erlementovich / functions.php
Created July 10, 2020 07:09 — forked from Santel/functions.php
Remove first image from WordPress post
//* Remove first image from single post
function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_home()){
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');
@erlementovich
erlementovich / pug.md
Created January 16, 2020 18:40 — forked from neretin-trike/pug.md
Туториал по HTML препроцессору Pug (Jade)
<?php
if ( have_posts() ) : // если имеются записи в блоге.
query_posts('cat=3'); // указываем ID рубрик, которые необходимо вывести.
while (have_posts()) : the_post(); // запускаем цикл обхода материалов блога
?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; // завершаем цикл.
endif;
/* Сбрасываем настройки цикла. Если ниже по коду будет идти еще один цикл, чтобы не было сбоя. */
wp_reset_query();
/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
.animated {
/*CSS transitions*/
-o-transition-property: none !important;
-moz-transition-property: none !important;
-ms-transition-property: none !important;
-webkit-transition-property: none !important;
transition-property: none !important;
/*CSS transforms*/