Skip to content

Instantly share code, notes, and snippets.

@yousufansa
yousufansa / functions.php
Last active February 16, 2021 16:29
Jobhunt - Change the WP Job Manager Core Add-ons Page Sign in URL
add_filter( 'submit_job_form_login_url', 'jobhunt_submit_job_form_login_url' );
add_filter( 'job_manager_job_dashboard_login_url', 'jobhunt_submit_job_form_login_url' );
add_filter( 'submit_resume_form_login_url', 'jobhunt_submit_job_form_login_url' );
add_filter( 'resume_manager_candidate_dashboard_login_url', 'jobhunt_submit_job_form_login_url' );
add_filter( 'job_manager_alerts_login_url', 'jobhunt_submit_job_form_login_url' );
add_filter( 'job_manager_bookmark_form_login_url', 'jobhunt_submit_job_form_login_url' );
add_filter( 'job_manager_past_applications_login_url', 'jobhunt_submit_job_form_login_url' );
@fritids
fritids / Count of Post Views (Post View Counter).php
Created February 13, 2014 13:50
Count of Post Views (Post View Counter)
<?php
/***************************************************************************
* Function: Sets, Tracks and Displays the Count of Post Views (Post View Counter)
*********************************************************************************/
//Set the Post Custom Field in the WP dashboard as Name/Value pair
function dp_PostViews($post_ID) {
//Set the name of the Posts Custom Field.
$count_key = 'post_views_count';
@farleyta
farleyta / CPT-Admin.php
Created February 8, 2014 10:15
A bunch of functions to allow a custom Editor-like role for managing a specific Custom Post Type in Wordpress.
<?php
// Register Region CPT
add_action( 'init', 'register_cpt_region' );
function register_cpt_region() {
$labels = array(
'name' => _x( 'Regions', 'region' ),
<html>
<head>
<title>Petitions Revisited</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<h1>Petitions Revisited</h1>
<?php
if ( ! defined( 'VIP_CUSTOM_MOBILE_TEMPLATE' ) )
// if using a child theme, this should be the parent (else you'll facepalm later)
define( 'VIP_CUSTOM_MOBILE_TEMPLATE', 'vip/theme' );
if ( ! defined( 'VIP_CUSTOM_MOBILE_STYLESHEET' ) )
define( 'VIP_CUSTOM_MOBILE_STYLESHEET', 'vip/theme-child-mobile' );
add_action( 'jetpack_modules_loaded', function() {
@tcelestino
tcelestino / wp-mail-fork.php
Created January 9, 2014 09:13
WP-Mail plugin modify
<?php
/**
* Plugin Name: WP-EMail
* Plugin URI: http://lesterchan.net/portfolio/programming/php/
* Description: Allows people to recommand/send your WordPress blog's post/page to a friend.
* Version: 2.52
* Author: Lester 'GaMerZ' Chan
* Author URI: http://lesterchan.net
*/
/*
@messaoudi-mounir
messaoudi-mounir / exclude-members-by-roles.php
Last active December 15, 2020 12:42
Buddypress Exclude members by roles
function get_user_ids_by_role($role){
$users=array();
$founded_users = get_users( array( 'role' => $role ) );
if(!empty($founded_users)){
foreach((array)$founded_users as $user)
$users[]=$user->ID;
}
return $users;
}
@miguelbalparda
miguelbalparda / gist:8221903
Last active January 2, 2016 00:09
Change store by location - Magento
$ip = $_SERVER["REMOTE_ADDR"];//cant use helper, not loaded yet
$location = file_get_contents('http://api.ipinfodb.com/v3/ip-city/?key=<api_key>&format=json&ip='.$ip.'');
$location = json_decode($location);
$country = $location->countryCode;
if(strcmp($country,'CA') == 0) {
$mageRunType = 'store';
$mageRunCode = 'en_ca';
@trovster
trovster / classy_user.php
Last active December 31, 2015 00:39
Partly stripped down Classy_User class which makes interacting with a logged in WordPress user much easier.
<?php
class Classy_User extends WP_User {
protected $_post_type = 'user',
$_favourites = null;
protected static $instance = null;
protected static $form_fields = array(
function getState_add(countryId)
{
ajax= nuevoAjax();
var url="getstate_add.php";
url=url+"?id="+countryId;
//alert(url);
ajax.open ("GET",url, true);
ajax.onreadystatechange= function()
{
if (ajax.readyState == 4)