Put these snippet in functions.php
//HIDE IF LOGGED OUT function hide_if_logged_out(){ if ( is_user_logged_in() ) { echo ''; } else { echo 'hidden'; } }
Call the function as class
<div class="container <?php echo hide_if_logged_out(); ?>">
Put these snippet in functions.php
//HIDE IF LOGGED OUT function hide_if_logged_out(){ if ( is_user_logged_in() ) { echo ''; } else { echo 'hidden'; } }
Call the function as class
<div class="container <?php echo hide_if_logged_out(); ?>">
<?php global $post; $post_slug=$post->post_name; ?>
Add this snippet to functions.php
add_filter( 'woocommerce_shipping_package_name', 'custom_shipping_package_name' ); function custom_shipping_package_name( $name ) { return 'Szállítás'; }
/* Alapértelmezett WordPress 'Bejegyzés' átnevezése */ function revcon_change_post_label() { global $menu; global $submenu; $menu[5][0] = 'Blog'; $menu[5][6] = 'dashicons-format-status'; $submenu['edit.php'][5][0] = 'Összes blogbejegyzés'; $submenu['edit.php'][10][0] = 'Új bejegyzés írása'; //$submenu['edit.php'][16][0] = 'News Tags'; echo ''; } function revcon_change_post_object() { global $wp_post_types; $labels = &$wp_post_types['post']->labels; $labels->name = 'Blog'; $labels->singular_name = 'News'; $labels->add_new = 'Új bejegyzés írása'; $labels->add_new_item = 'Új bejegyzés írása'; $labels->edit_item = 'Edit News'; $labels->new_item = 'News'; $labels->view_item = 'View News'; $labels->search_items = 'Blogbejegyzés keresése'; //$labels->not_found = 'No News found'; //$labels->not_found_in_trash = 'No News found in Trash'; $labels->all_items = 'Összes blogbejegyzés'; $labels->menu_name = 'Blog'; $labels->name_admin_bar = 'Blog'; } add_action( 'admin_menu', 'revcon_change_post_label' ); add_action( 'init', 'revcon_change_post_object' );
<?php add_action( 'customize_register', 'wts_register_theme_customizer' ); /* * Register Our Customizer Stuff Here */ function wts_register_theme_customizer( $wp_customize ) { // Create custom panel. $wp_customize->add_panel( 'text_blocks', array( 'priority' => 500, 'theme_supports' => '', 'title' => __( 'Text Blocks', 'wts' ), 'description' => __( 'Set editable text for certain content.', 'wts' ), ) ); // Add section. $wp_customize->add_section( 'custom_cta_title_text' , array( 'title' => __('Change CTA Title Text','wts'), 'panel' => 'text_blocks', 'priority' => 10 ) ); // Add setting $wp_customize->add_setting( 'cta_title_text_block', array( 'default' => __( 'default text', 'wts' ), 'sanitize_callback' => 'sanitize_text' ) ); // Add control $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'custom_cta_title_text', array( 'label' => __( 'CTA Title Text', 'wts' ), 'section' => 'custom_cta_title_text', 'settings' => 'cta_title_text_block', 'type' => 'text' ) ) ); // Sanitize text function sanitize_text( $text ) { return sanitize_text_field( $text ); } }
<?php echo get_theme_mod( 'cta_title_text_block'); ?>
<?php $kapcsolat_query = new WP_Query(array( 'post_type' => array('page'), 'post__in' => array(760) )); ?> <?php while ($kapcsolat_query->have_posts()) : $kapcsolat_query->the_post(); ?> <?php endwhile; ?>
Echo the return value from wp_get_attachment_image_src(). It also returns an Array(), so you need to grab the needed part from that array. In this case it’s the first/0 value. Example:
<?php $bgImage = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
Include tha variable inside the inline stylesheet
<section class="contact-cover" style=" background: url('<?php echo $bgImage[0]; ?>'); background-size: cover; background-attachment: fixed; padding: 60px 0;"> </section>
<?php global $post; $post_slug=$post->post_name; ?>
function shapeSpace_popular_posts($post_id) { $count_key = 'popular_posts'; $count = get_post_meta($post_id, $count_key, true); if ($count == '') { $count = 0; delete_post_meta($post_id, $count_key); add_post_meta($post_id, $count_key, '0'); } else { $count++; update_post_meta($post_id, $count_key, $count); } } function shapeSpace_track_posts($post_id) { if (!is_single()) return; if (empty($post_id)) { global $post; $post_id = $post->ID; } shapeSpace_popular_posts($post_id); } add_action('wp_head', 'shapeSpace_track_posts');
<h3>Legnépszerűbb bejegyzések</h3> <?php $args = array( 'posts_per_page'=>3, 'meta_key'=>'popular_posts', 'orderby'=>'meta_value_num', 'order'=>'DESC' ); $popular = new WP_Query( $args ); ?> <div class="popular-posts"> <?php while ($popular->have_posts()) : $popular->the_post(); ?> <div class="row"> <div class="col-md-4"> <?php the_post_thumbnail( 'full', array('class' => 'img-responsive ') ); ?> </div> <div class="col-md-8"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <time class="entry-date"><?php the_date('Y-m-d'); ?></time> </div> </div> <?php endwhile; wp_reset_postdata(); ?> </div>
/* * * Let's us override the default comment template * located at wp-includes/comment-template.php and * use our own comment file instead. * */ function custom_comment_template( $comment_template ) { return dirname(__FILE__) . '/inc/custom-comment-template.php'; } add_filter( 'comments_template', 'custom_comment_template' );
/* * * Let's us add options for customizing our theme * from the build in WordPress Customize screen. * Gives access to four methods we can use with * the hook. * */ function my_theme_customizations( $wp_customize ) { /* * The $wp_customize object we pass as a parameter * gives us access to the following methods: * * - add_setting() * - add_section() * - add_control() * - get_setting() * */ } add_action( 'customize_register', 'my_theme_customizations' );
/* * Let's us display code inside of the <head> * tags in the WordPress admin area. * We will use this to custom CSS for our plugin * with the WordPress admin area * */ function my_plugin_back_end_css() { wp_enqueue_style( 'my_plugin_back_end_css', plugins_url('css/back-end.css', __FILE__) ); } add_action( 'admin_head', 'my_plugin_back_end_css' );
If You want to use Google Font on your WordPress site, You will need to enqueue it in the functions.php
Now just add the following CSS
* { font-family: 'Poppins', sans-serif; }
<?php wp_reset_postdata(); $args = array( 'post_type' => 'team', 'posts_per_page' => 100 ); $the_query = new WP_Query( $args ); ?> <div class="container"> <div class="row"> <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div class="col-md-4"> <div class="card member"> <a href="<?php the_permalink(); ?>"> <img class="card-img-top" src="<?php the_field('image'); ?>" alt=""> </a> <div class="card-body"> <h3 class="card-title"><?php the_title(); ?></h3> <p class="card-text hidden"><?php the_field('description'); ?></p> <a class="hidden" href="<?php the_permalink(); ?>" class="btn btn-primary">Read more</a> </div> </div> </div> <?php endwhile; endif; ?> </div><!--row--> </div><!--container--> <?php wp_reset_postdata(); ?>
If the shortcode produces a lot of HTML then ob_start can be used to capture output and convert it to a string as follows:
// ========================================================================= // REGISTER NEW WIDGET // ========================================================================= function custom_widgets_init() { register_sidebar( array( 'name' => 'Custom Widget', 'id' => 'custom-widget-id', 'before_widget' => '<div class="custom-widget">', 'after_widget' => '</div>', 'before_title' => '<h4 class="custom-title">', 'after_title' => '</h4>', ) ); } add_action( 'widgets_init', 'custom_widgets_init' );
<?php dynamic_sidebar('Custom Widget'); ?>
<?php function wpf_filter_gettext( $translated, $original, $domain ) { if ( $translated == "OLD_TEXT" ) { $translated = "NEW_TEXT"; } return $translated; } add_filter( 'gettext', 'wpf_filter_gettext', 10, 3 );
function remove_translation( $translated_text, $untranslated_text, $domain ) { $removable_text = 'Ide kerül az eltávolítani kívánt kifejezés.'; if ($untranslated_text === $removable_text ) { return ''; } return $translated_text; }
<?php /** * Plugin Name: Disable Comments * Plugin URI: https://codex.wordpress.org * Author: @wpflames */ // Disable support for comments and trackbacks in post types function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'df_disable_comments_post_types_support'); // Close comments on the front-end function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Hide existing comments function df_disable_comments_hide_existing_comments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2); // Remove comments page in menu function df_disable_comments_admin_menu() { remove_menu_page('edit-comments.php'); } add_action('admin_menu', 'df_disable_comments_admin_menu'); // Redirect any user trying to access comments page function df_disable_comments_admin_menu_redirect() { global $pagenow; if ($pagenow === 'edit-comments.php') { wp_redirect(admin_url()); exit; } } add_action('admin_init', 'df_disable_comments_admin_menu_redirect'); // Remove comments metabox from dashboard function df_disable_comments_dashboard() { remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); } add_action('admin_init', 'df_disable_comments_dashboard'); // Remove comments links from admin bar function df_disable_comments_admin_bar() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } } add_action('init', 'df_disable_comments_admin_bar'); //END DISABLE COMMENTS //REMOVE LOST PASSWORD function remove_lostpassword_text ( $text ) { if ($text == 'Elfelejtett jelszó?'){$text = '';} return $text; } add_filter( 'gettext', 'remove_lostpassword_text' );
function genesis_do_search_title() { global $wp_query; $total_results = $wp_query->found_posts; $title = sprintf( '<div class="archive-description"><h1 class="archive-title">%s '. $total_results .' találat a "%s" kifejezésre </h1></div>', apply_filters( 'genesis_search_title_text', __( 'Search Results for:', 'genesis' ) ), get_search_query() ); echo apply_filters( 'genesis_search_title_output', $title ) . "\n"; }