Skip to content

Instantly share code, notes, and snippets.

View Fobiya's full-sized avatar
:octocat:
I may be slow to respond.

Fobiya

:octocat:
I may be slow to respond.
  • Kiev Ukraine
View GitHub Profile
@Fobiya
Fobiya / wp ajax scroll section
Last active February 7, 2020 11:28
wp ajax scroll section
<script type='text/javascript'>
$( document ).ready(function() {
$('footer').addClass('none');
var anchors = [];
var currentAnchor = -1;
var isAnimating = false;
@Fobiya
Fobiya / WP Views
Last active June 1, 2020 16:02
WP Views post_views_count
Добавим этот код functions.php ( для удобства разместите в конце файла ).
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 просмотров";
}
@Fobiya
Fobiya / json-php-wp
Last active June 10, 2020 13:33
json-php-wp
wp-json/wp/v2/posts?_embed&per_page=24&page=1
wp-json/wp/v2/blog/?_embed&per_page=24&page=1
blog - // category
?_embed - // echo list img and list topic
http://domennn/wp-json/wp/v2/blog?_embed&categories=16
@Fobiya
Fobiya / error php
Created April 17, 2020 13:57
error php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
@Fobiya
Fobiya / is_user_logged
Last active April 21, 2020 10:46
is_user_logged wp
<?php if (is_user_logged()) { ?>
<a href="<?php echo do_shortcode(''); ?>" class="btn btn-primary btn-xs"><?php _e('Trade now', 'oh'); ?></a>
<?php } else { ?>
<a href="<?php echo do_shortcode(''); ?>" class="btn btn-primary btn-xs"><?php _e('Sign Up', 'oh'); ?></a>
<?php } ?>
@Fobiya
Fobiya / WP date
Last active May 7, 2020 11:41
WP date
<?php the_modified_time('n j, Y');?>
<br>
<?php echo date( 'n j, Y');?>
<br>
<?php echo get_field('datapicer') ?>
<?php
$post_n = get_field('datapicer');
$post_t = date('m d, Y');
@Fobiya
Fobiya / map api
Created May 8, 2020 12:54
map api
<style>
#map {
height: 360px;
width: 100%;
}
</style>
<script type="text/javascript">
function createMap(){
@Fobiya
Fobiya / jQuery add application
Created May 28, 2020 09:45
jQuery add application
jQuery('.after-forgot-password').html('');
jQuery('.after-forgot-password').append(`<p><?php _e('DEMOs BOOOM'); ?><p>`);
@Fobiya
Fobiya / rest_api_init add input
Created June 19, 2020 16:18
rest_api_init add input
rest_api_init add input
/wp-json/wp/v2/blog/33393?&_embed
/**** getPostViews ****/
@Fobiya
Fobiya / checkbox
Last active June 25, 2020 01:38
checkbox
$('.check').click(function(){
this.value = (this.value)?'':this.dataset.check;
});
$( document ).ready(function() {
$('input[type="checkbox"]').click(function() {
if ($(this).val() === '') {
$(this).val($(this).data("check"));
} else {