Skip to content

Instantly share code, notes, and snippets.

<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>
@BahtaDima
BahtaDima / WordPress get tags
Created October 20, 2016 07:29
WordPress get tags
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo '<p>Tag: <a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> ';
}
}
?>
<?php
$tags = wp_get_post_tags($post->ID);
<?php date('Y'); ?> // вывод теперевней даты
<?php echo get_cat_name(id); ?> // вывод имени рубрики
<?php echo category_description(id); ?> // вывод описание рубрики
<?php
add_action( 'admin_init', 'theme_options_init' );
add_action( 'admin_menu', 'theme_options_add_page' );
/**
* Init plugin options to white list our options
*/
function theme_options_init(){
register_setting( 'sample_options', 'sample_theme_options', 'theme_options_validate' );
@BahtaDima
BahtaDima / post-thumbnail.html
Created October 20, 2016 09:26 — forked from agragregra/post-thumbnail.html
WordPress Post Thumbnail URL
<?php $url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); $url = $url['0']; ?>
@BahtaDima
BahtaDima / WordPress Get Category name By label
Created October 20, 2016 09:28
WordPress Get Category name By label
<?php
$idObj = get_category_by_slug('s_about');
$id = $idObj->term_id;
echo get_cat_name($id);
?>
<ul class="first_menu">
<li class="sitebar_head">Все статьи данного раздела:</li>
<li class="link">Бесплатная игровые автоматы <i class="fa fa-angle-right" aria-hidden="true"></i>казино </li>
<ul class="menu">
<li><a class="link_menu_active" href="#">List Item 1</a></li>
<li><a class="link_menu_active" href="#">List Item 2</a></li>
<li><a class="link_menu_active" href="#">List Item 3</a></li>
<li><a class="link_menu_active" href="#">List Item 5</a></li>
<li><a class="link_menu_active" href="#">List Item 6</a></li>
<li><a class="link_menu_active" href="#">List Item 7</a></li>
$(document).ready(function() {
//Таймер обратного отсчета
//Документация: http://keith-wood.name/countdown.html
//<div class="countdown" date-time="2015-01-07"></div>
var austDay = new Date($(".countdown").attr("date-time"));
$(".countdown").countdown({until: austDay, format: 'yowdHMS'});
//Попап менеджер FancyBox
//Документация: http://fancybox.net/howto
/*Base style*/
*::-webkit-input-placeholder
color: #1e1e1e
opacity: 1
*:-moz-placeholder
color: #666
opacity: 1
*::-moz-placeholder
$(".top_nav a, .top").mPageScroll2id({
offset: 50,
scrollSpeed: 1000
});