This file contains 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 | |
/** | |
* !!WARNING!! | |
* This script will delete everything you have in wordpress. | |
* I use it only when developing something that requires me to delete everything, e.g. importer. | |
* You can comment some parts out if you need to quickly delete just posts, or pages or so, but still be very careful!!! | |
* | |
* @author Denis Žoljom (https://github.com/dingo-d) | |
* @license Free to use at your own risk |
This file contains 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 | |
global $wp_query; | |
$total_pages = $wp_query->max_num_pages; | |
if ($total_pages > 1){ | |
$current_page = max(1, get_query_var('paged')); | |
$permalink_structure = get_option('permalink_structure'); | |
$format = empty( $permalink_structure ) ? '?paged=%#%' : 'page/%#%/'; | |
echo ' | |
<section id="pagination" class="clearfix"> | |
<div class="container"> |
This file contains 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 | |
add_action('admin_init', 'add_meta_boxes', 1); | |
function add_meta_boxes() { | |
add_meta_box( 'repeatable-fields', esc_html__('Related Articles', 'mytheme'), 'my_related_articles_meta_box_display', 'post', 'normal', 'high'); | |
} | |
function my_related_articles_meta_box_display() { |
This file contains 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
<header id="main_header" class="clearfix"> | |
<div class="top_bar"> | |
<div class="container"> | |
<div class="ajax_login"> | |
<form id="login" action="login" method="post"> | |
<h1><?php esc_attr_e('User login','yourtheme') ?></h1> | |
<p class="status"></p> | |
<input id="username" type="text" name="username" placeholder="<?php esc_attr_e('Username','yourtheme') ?>"> | |
<input id="password" type="password" name="password" placeholder="<?php esc_attr_e('Password','yourtheme') ?>"> | |
<div class="forgotten_box"> |
This file contains 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 | |
/********* AJAX Login ***********/ | |
function yourtheme_ajax_login_init(){ | |
wp_register_script('ajax-login-script', get_template_directory_uri() . '/js/ajax-login-script.js', array('jquery') ); | |
wp_enqueue_script('ajax-login-script'); | |
wp_localize_script( 'ajax-login-script', 'ajax_login_object', array( | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), |
This file contains 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
jQuery(document).ready(function($) { | |
"use strict"; | |
// Show the login dialog box on click | |
$('a#show_login').on('click', function(e){ | |
$('.ajax_login_overlay').fadeIn(500); | |
$('form#login').fadeIn(500); | |
e.preventDefault(); | |
}); |
This file contains 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
/*------------------------ AJAX login -------------------------*/ | |
.top_bar{ | |
text-align: right; | |
} | |
.top_bar .ajax_login{ | |
display: inline-block; | |
margin-right: 10px; | |
} |
This file contains 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
/********* Custom Registration Form ***********/ | |
add_action( 'register_form', 'travelnews_register_form' ); | |
if (!function_exists('travelnews_register_form')) { | |
function travelnews_register_form() { | |
$first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : ''; | |
$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : ''; |
This file contains 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 | |
/** | |
The below code goes in customizer.php of your theme | |
**/ | |
/** | |
------------------------------------------------------------ | |
SECTION: Post order on home page and index pages | |
------------------------------------------------------------ |
OlderNewer