Skip to content

Instantly share code, notes, and snippets.

@Montesk
Montesk / wp-query-ref.php
Created November 1, 2015 14:24 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
$(".section_4").waypoint(function() {
$(".section_4 .card").each(function(index) {
var ths = $(this);
setInterval(function() {
ths.removeClass("card-off").addClass("card-on");
}, 200*index);
});
}, {
mail.php
<?php
if(isset($_POST)){
$arr = array();
$arr = $_POST;
$site_owner_email = "[email protected]";
$subject = "Сообщение с сайта ".$_SERVER['SERVER_NAME'];
$headers = "From: ".$_SERVER['SERVER_NAME']."\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
<?php while ( have_posts() ) : the_post(); ?>
<?php
$post_id = get_the_ID();
$category = get_the_category($post_id);
?>
<header class="page-header">
<?php while ( have_posts() ) : the_post(); ?>
<?php
if ( has_post_thumbnail() ) {
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute( 'echo=0' ) . '" class="fancybox blog-thumb img-responsive">';
the_post_thumbnail( 'large' );
echo '</a>';
}
?>
@Montesk
Montesk / wp_query example
Last active October 27, 2015 08:40
Wordpress work functions
wp_query and pagination (pagination in functions.php)
<?php // Display blog posts on any page @ http://m0n.co/l
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$temp = $wp_query;$wp_query= null;
$wp_query = new WP_Query(); $wp_query->query('showposts=7' . '&paged='. $paged . '&cat=-41');
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
//displaying thumbnail for fancybox
<?php