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
/* Automatically set the image Title, Alt-Text, Caption & Description upon upload | |
--------------------------------------------------------------------------------------*/ | |
add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' ); | |
function my_set_image_meta_upon_image_upload( $post_ID ) { | |
// Check if uploaded file is an image, else do nothing | |
if ( wp_attachment_is_image( $post_ID ) ) { | |
$my_image_title = get_post( $post_ID )->post_title; |
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 | |
// define constant | |
define('PS_THEME_ROOT', get_template_directory_uri()); | |
define('PS_CSS_DIR', PS_THEME_ROOT . '/assets/css'); | |
define('PS_JS_DIR', PS_THEME_ROOT . '/assets/js'); | |
define('PS_IMG_DIR', PS_THEME_ROOT . '/assets/img'); | |
// правильный способ подключить стили и скрипты | |
add_action('wp_enqueue_scripts', 'theme_name_scripts'); |
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
<div id="main-slider" class="carousel slide mt-4" data-ride="carousel"> | |
<?php $args = array( | |
'posts_per_page' => 5, | |
'tag' => 'slider' | |
); | |
$slider = new WP_Query($args); | |
if($slider->have_posts()): | |
$count = $slider->found_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
// ------------------------------------ | |
// Hide the element untill page loaded | |
// ------------------------------------ | |
// HTML | |
<div id="my-modals" class="hide"> | |
// CSS | |
.hide { | |
dislplay:none; |
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 | |
// in functions.php create the CUSTOM POST TYPE | |
// create CPT = reviews | |
add_action('init', 'my_first_post_type'); | |
function my_first_post_type() | |
{ | |
// for thumbnails to be recognised | |
add_theme_support('post-thumbnails'); | |
// CPT reviews | |
register_post_type('reviews', [ |
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
/* | |
!wp-content/ | |
.* | |
!.gitignore | |
!readme.md | |
~* |
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 | |
// Register Custom Post Type in functions.php | |
add_action( 'pre_get_posts', 'add_my_post_types_to_query' ); | |
function add_my_post_types_to_query( $query ) { | |
if ( is_home() && $query->is_main_query() ) | |
$query->set( 'post_type', array( 'post', 'movies' ) ); | |
return $query; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Marker Leaflet Map</title> | |
<meta charset="utf-8" /> | |
<link | |
rel="stylesheet" | |
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" | |
/> | |
</head> |
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 my_styles_scripts_method(){ | |
// load main style.css | |
wp_enqueue_style('main_style', get_stylesheet_uri()); | |
//load aditional css file | |
wp_enqueue_style('default_style', get_template_directory_uri().'/assets/css/default.css'); | |
wp_enqueue_style('layout_style', get_template_directory_uri().'/assets/css/layout.css'); | |
wp_enqueue_style('media_queries_style', get_template_directory_uri().'/assets/css/media-queries.css'); | |
// load scripts |
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
<div class="searchBox"> | |
<input type="text" class="searchInput" placeholder="Search"> | |
<div class="searchHandle"></div> | |
</div> | |
----------------- | |
*{ | |
box-sizing: border-box; | |
} |