Skip to content

Instantly share code, notes, and snippets.

@merli129
merli129 / ChildComponent.vue
Created October 23, 2017 20:29 — forked from sproogen/ChildComponent.vue
Vee Validate - Child Component Example
<template>
<div>
<input v-validate data-rules="required" :class="{'has-error': errors.has("textInput")}" id="textInput" name="textInput" type="text">
<span class="error" v-show="errors.has("textInput")">{{ errors.first("textInput") }}</span>
</div>
</template>
<script>
import { find, propEq } from 'ramda'
import bus from './bus'
@merli129
merli129 / change_order.php
Last active February 20, 2017 20:41
Wordpress comment fields order
<?php
add_filter('comment_form_fields', 'qoob_reorder_comment_fields');
function qoob_reorder_comment_fields($fields){
$new_fields = array();
$myorder = array('author', 'email', 'comment');
foreach($myorder as $key){
$new_fields[$key] = $fields[$key];
@merli129
merli129 / wp_pag.php
Created February 19, 2017 12:34
Wordpress Pagination
<?php
/**
* WordPress Bootstrap Pagination
*/
function wp_bootstrap_pagination( $args = array() ) {
$defaults = array(
'range' => 4,
'custom_query' => FALSE,
'previous_string' => __( 'Previous', 'text-domain' ),
@merli129
merli129 / b_crumbs.php
Created February 19, 2017 12:32
Wordpress breadcrumbs
function the_breadcrumb(){
global $post;
if(!is_home()){
echo '<a href="'.site_url().'">Главная</a> &amp;raquo; ';
if(is_single()){ // записи
the_category(', ');
echo " &amp;raquo; ";
the_title();
}
elseif (is_page()) { // страницы
<?php
$idObj = get_category_by_slug('s_about');
$id = $idObj->term_id;
echo get_cat_name($id);
?>
<?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);
@merli129
merli129 / wp_notes.php
Last active February 17, 2017 18:35
Wordpress Notes
<!--Post Thumbnail Linking to the Post Permalink-->
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
<!--Post Thumbnail Link-->
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
echo $large_image_url[0] <!--Link Itself-->
@merli129
merli129 / query_posts.php
Last active February 17, 2017 17:54
WordPress query_posts
<?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(); ?>
<!--Another version-->
@merli129
merli129 / mp.html
Created February 15, 2017 17:18
Magnific Popup Usage
<h3>Magnific Popup CSS3-based animation effects</h3>
<div class="links">
<h4>Text-based:</h4>
<ul id="inline-popups">
<li><a href="#test-popup" data-effect="mfp-zoom-in">Zoom</a></li>
<li><a href="#test-popup" data-effect="mfp-newspaper">Newspaper</a></li>
<li><a href="#test-popup" data-effect="mfp-move-horizontal">Horizontal move</a></li>
<li><a href="#test-popup" data-effect="mfp-move-from-top">Move from top</a></li>
<li><a href="#test-popup" data-effect="mfp-3d-unfold">3d unfold</a></li>
<li><a href="#test-popup" data-effect="mfp-zoom-out">Zoom-out</a></li>
@merli129
merli129 / sandwich.html
Last active February 13, 2017 16:50
Animated Sandwich Icon
<div id='sandwich'>
<div class='sw-topper'></div>
<div class='sw-bottom'></div>
<div class='sw-footer'></div>
</div>