View functions.php
function wpb_widgets_init() { | |
register_sidebar( array( | |
'name' => __( 'Main Sidebar', 'wpb' ), | |
'id' => 'sidebar-1', | |
'description' => __( 'The main sidebar appears on the right on each page except the front page template', 'wpb' ), | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', |
View functions.php
/** | |
* Disable the emoji's | |
*/ | |
function disable_emojis() { | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); | |
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
View functions.php
function wpb_set_post_views($postID) { | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
$count = 0; | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, '0'); | |
}else{ | |
$count++; | |
update_post_meta($postID, $count_key, $count); |
View functions.php
<?php | |
//Create an admin user | |
function smartwp_create_admin_user(){ | |
$username = 'yourusername'; | |
$password = '2JyAEQJ9B9Jf5T8a'; | |
$email = 'change@me.com'; | |
//This will ensure it only tries to create the user once (based on email/username) | |
if ( !username_exists( $username ) && !email_exists( $email ) ) { | |
$userid = wp_create_user( $username, $password, $email ); | |
$user = new WP_User( $userid ); |
View single.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 View"; | |
} | |
return $count.' Views'; | |
} |
View functions.php
//AJAX CALL FUNCTION | |
function getCandidate_Func(){ | |
$nonce = $_POST['feedBackNonceField']; | |
if ( ! wp_verify_nonce( $nonce, 'getCandidateFunc' ) ) | |
die ( 'Busted!'); | |
die(); | |
View .htacess
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] | |
Header always set Content-Security-Policy "upgrade-insecure-requests;" | |
RewriteRule ^page-1$ page.php?area=1 | |
RewriteRule ^page-2$ page.php?area=1 |
View functions.php
function testimonial_post_type() { | |
// Labels | |
$labels = array( | |
'name' => _x("Testimonials", "post type general name"), | |
'singular_name' => _x("Testimonial", "post type singular name"), | |
'menu_name' => 'Testimonials', | |
'add_new' => _x("Add New", "testimonial item"), | |
'add_new_item' => __("Add New Testimonial"), | |
'edit_item' => __("Edit Testimonial"), |
View index.php
<?php | |
$curl = curl_init(); | |
$ApiKey = "<APIKEY>"; | |
$postedcarreg = '<CARREG>'; | |
$carreg = $postedcarreg; | |
$datatype = "VehicleData"; | |
$url = "https://uk1.ukvehicledata.co.uk/api/datapackage/%s?v=2&api_nullitems=1&key_vrm=%s&auth_apikey=%s"; | |
$url = sprintf($url, $datatype , $carreg, $ApiKey); // Syntax: sprintf($url, "PackageName", "VRM", ApiKey); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => $url, |
View index.py
#!/usr/bin/python | |
import os | |
import urllib | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.chrome.options import Options | |
chrome_options = Options() | |
chrome_options.add_argument("--headless") |
NewerOlder