Skip to content

Instantly share code, notes, and snippets.

View MjHead's full-sized avatar

Andrew Shevchenko MjHead

  • Crocoblock
  • Ukraine
View GitHub Profile
<?php
add_filter( 'jet-blog/smart-listing/query-args', 'my_smart_listing_args' );
function my_smart_listing_args( $args ) {
$args['post_type'] = array( 'post', 'page' );
return $args;
}
@MjHead
MjHead / format-date.php
Last active March 6, 2018 11:00
Add own callback function for meta controls in Smart List for JetBlog
<?php
/**
* Add callback function for date formatting into available callbacks list in control.
*/
function my_update_meta_controls( $widget ) {
foreach ( array( 'title_related', 'content_related' ) as $position ) {
$control = $widget->get_controls( $position . '_meta' );
@MjHead
MjHead / order-by-custom-field.php
Last active March 6, 2018 15:16
Add order by custom field for Smart Listing widget
<?php
add_filter( 'jet-blog/smart-listing/query-args', 'my_listing_query_args' );
function my_listing_query_args( $args ) {
$args['meta_key'] = 'your_key'; // Set meta key to sort by
$args['orderby'] = 'meta_value';
$args['order'] = 'DESC';
$args['meta_type'] = 'DATE';
<?php
function my_smart_listing_classes( $classes ) {
global $post;
$terms = get_the_terms( $post->ID, 'category' );
if ( ! empty( $terms ) ) {
foreach ( $terms as $term ) {
$classes[] = 'category-' . $term->slug;
}
<?php
/**
* Post item template
*/
global $post;
$terms = get_the_terms( $post->ID, 'category' );
$terms_classes = '';
<?php
add_action( 'init', 'finscore_plugins_wizard_config', 9 );
add_action( 'init', 'finscore_data_importer_config', 9 );
/**
* Register Jet Plugins Wizards config
*/
function finscore_plugins_wizard_config() {
if ( ! is_admin() ) {
.jet-posts__inner-box {
display: flex;
flex-direction: column;
}
.jet-posts__inner-box .post-thumbnail {
order: 2;
}
.jet-posts__inner-box {
display: flex;
}
/**
* Enqueue Fontawesome icon font into your website.
* Before adding this code, please ensure that you put Fontawesome CSS and webfont into fontawesome folder in your theme.
*/
function jet_enqueue_icon_font() {
wp_enqueue_style( 'fontawesome5', get_theme_file_uri( 'fontawesome/css/fontawesome.min' ) );
}
add_action( 'wp_enqueue_scripts', 'jet_enqueue_icon_font' );
<?php
add_action(
'elementor/element/jet-blog-smart-listing/section_custom_fields/before_section_end',
'jet_custom_meta_callbacks'
);
add_action(
'elementor/element/jet-blog-smart-tiles/section_custom_fields/before_section_end',
'jet_custom_meta_callbacks'