This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_json($url,$id){ | |
$_url = $url.$id; | |
$transient = get_transient( $_url ); | |
if(!empty($transient)){ | |
return $transient; | |
}else{ | |
$request = wp_remote_get( $_url ); | |
if( is_wp_error( $request ) ) { | |
return false; // Bail early |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for POST in $(wp post list --post_type=locations --meta_key=page_subtype --meta_value=event --format=ids); do wp post update $POST --post_status=draft; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for POST in $(wp post list --post_type=post --category_name=tiskovky --format=ids); do wp post update $POST --post_type=tiskovky; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for col in posts|batch((posts|length / 2)|round(0, 'ceil')) %} | |
<div class="col-12 col-sm-6"> | |
{% for item in col %} | |
<a href="{{ item.link }}"> | |
{{ item.title }} | |
</a> | |
{% endfor %} | |
</div> | |
{% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function replacer($post_type, $field, $find, $replace, $wet){ | |
$args = array( | |
'post_type' => $post_type, | |
'posts_per_page' => -1, | |
'post_status' => 'any' | |
); | |
$the_query = new WP_Query( $args ); | |
if ($the_query->have_posts()) { | |
while ( $the_query->have_posts() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function($) { | |
function findCommonElement(filters,classes) { | |
var result = true; | |
for(let i = 0; i < filters.length; i++) { | |
if(!classes.includes(filters[i])){ | |
result = false; | |
break; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// field id must be the ACF ID | |
function post_images_to_ACF_gallery($post_type, $field_id){ | |
$args = array( | |
'post_status' => 'publish', | |
'post_type' => $post_type, | |
'posts_per_page' => -1, | |
'fields' => 'ids' | |
); | |
$the_query = new WP_Query( $args ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ constant('Twig_Environment::VERSION') }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'status' => 'approve', | |
'number' => 30, | |
'order' => 'DESC' | |
); | |
$comments = get_comments($args); | |
$post_ids = array_map(function($key, $value) { | |
return $value->comment_post_ID; | |
}, array_keys($comments), $comments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 1, 2, asc | |
usort($mix, function ($item1, $item2) { | |
return $item1->post_date <=> $item2->post_date; | |
}); |