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 | |
//page id | |
$page_id = "5"; //example | |
if (has_post_thumbnail($page_id) ): | |
$image = wp_get_attachment_image_src( get_post_thumbnail_id($page_id), 'single-post-thumbnail' ); | |
endif; | |
$image_URI = $image[0]; | |
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
//Bread crumbs created | |
function wordpress_breadcrumbs() { | |
$delimiter = '|'; | |
$currentBefore = '<span class="current">'; | |
$currentAfter = '</span>'; | |
if ( !is_home() && !is_front_page() || is_paged() ) { | |
echo '<div id="crumbs">'; | |
global $post; | |
if ( is_page() && !$post->post_parent ) { | |
echo $currentBefore; |
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 | |
// Magento: Getting categroy from product | |
$categoryIds = $_product->getCategoryIds(); | |
if(count($categoryIds) ){ | |
$firstCategoryId = $categoryIds[0]; | |
$_category = Mage::getModel('catalog/category')->load($firstCategoryId); | |
echo $_category->getData('categorysecondimage'); | |
} |
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
add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); | |
function myplugin_registration_save( $user_id ) { | |
$current_admin_user = wp_get_current_user(); | |
if ( isset( $_POST['first_name'] ) ){ | |
$user = new WP_User( $user_id ); | |
$user_roles = $user->roles; | |
$user_role = array_shift($user_roles); | |
if($user_role!="administrator"){ | |
update_user_meta($user_id, 'asso_admin', $current_admin_user->ID); | |
}else{ |
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 | |
/** maxmind geoip integration in php */ | |
function get_real_ip() { | |
$ipaddress = ''; | |
if(empty($_REQUEST['ip']) && @$_REQUEST['ip']==""){ | |
if (@$_SERVER['HTTP_CLIENT_IP']) | |
$ipaddress = @$_SERVER['HTTP_CLIENT_IP']; | |
else if(@$_SERVER['HTTP_X_FORWARDED_FOR']) | |
$ipaddress = @$_SERVER['HTTP_X_FORWARDED_FOR']; | |
else if(@$_SERVER['HTTP_X_FORWARDED']) |
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 | |
//usage: | |
//url_title($title); | |
if ( ! function_exists('url_title')) | |
{ | |
/** | |
* Create URL Title | |
* |
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
defaults delete ~/Library/Preferences/com.teamviewer.teamviewer9.plist | |
defaults delete ~/Library/Preferences/com.teamviewer.teamviewer9.Machine.plist | |
sudo defaults delete /Library/Preferences/com.teamviewer.teamviewer9.plist | |
rm -f ~/Library/Preferences/com.teamviewer.teamviewer9.plist | |
rm -f ~/Library/Preferences/com.teamviewer.teamviewer9.Machine.plist | |
sudo rm -f /Library/Preferences/com.teamviewer.teamviewer9.plist |
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 | |
// API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); | |
$registrationIds = array( $_GET['id'] ); | |
// prep the bundle | |
$msg = array |
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
#!/bin/bash -e | |
clear | |
echo "============================================" | |
echo "WordPress Install Script" | |
echo "============================================" | |
echo "Database Name: " | |
read -e dbname | |
echo "Database User: " | |
read -e dbuser | |
echo "Database Password: " |
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
wpcf7_add_shortcode('postdropdown', 'createbox', true); | |
function createbox(){ | |
global $post; | |
extract( shortcode_atts( array( 'post_type' => 'some_post_type',), $atts ) ); | |
$args = array('post_type' => $post_type ); | |
$myposts = get_posts( $args ); | |
$output = "<select name='postType' id='postType' onchange='document.getElementById(\"postType\").value=this.value;'><option></option>"; | |
foreach ( $myposts as $post ) : setup_postdata($post); | |
$title = get_the_title(); | |
$output .= "<option value='$title'> $title </option>"; |
OlderNewer