This file contains hidden or 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 VAT and SSN fields in billing address display | |
| add_filter( 'woocommerce_order_formatted_billing_address', 'custom_add_vat_ssn_formatted_billing_address', 10, 2 ); | |
| function custom_add_vat_ssn_formatted_billing_address( $fields, $order ) { | |
| $fields['vat'] = $order->billing_vat; | |
| $fields['ssn'] = $order->billing_ssn; | |
| return $fields; | |
| } | |
| add_filter( 'woocommerce_my_account_my_address_formatted_address', 'custom_my_account_my_address_formatted_address', 10, 3 ); |
This file contains hidden or 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 | |
| /* | |
| Plugin Name: Listing Content Item | |
| Plugin URI: | |
| Description: | |
| Author: | |
| Version: 1.0 | |
| Author URI: | |
| */ |
This file contains hidden or 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 | |
| /* | |
| Description: Adds a taxonomy filter in the admin list page for a custom post type. | |
| Written for: http://wordpress.stackexchange.com/posts/582/ | |
| By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins | |
| Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps... | |
| */ | |
| add_filter('manage_listing_posts_columns', 'add_businesses_column_to_listing_list'); | |
| function add_businesses_column_to_listing_list( $posts_columns ) { | |
| if (!isset($posts_columns['author'])) { |
This file contains hidden or 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 | |
| // define location of Parse PHP SDK, e.g. location in "Parse" folder | |
| // Defaults to ./Parse/ folder. Add trailing slash | |
| define( 'PARSE_SDK_DIR', './Parse/' ); | |
| // include Parse SDK autoloader | |
| require_once( 'autoload.php' ); | |
| // Add the "use" declarations where you'll be using the classes | |
| use Parse\ParseClient; |
This file contains hidden or 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 | |
| // post to page | |
| $page_post = (new FacebookRequest( $session, 'POST', '/'. $page_id .'/feed', array( | |
| 'access_token' => $access_token, | |
| 'name' => 'Facebook API: Posting As A Page using Graph API v2.x and PHP SDK 4.0.x', | |
| 'link' => 'https://www.webniraj.com/2014/08/23/facebook-api-posting-as-a-page-using-graph-api-v2-x-and-php-sdk-4-0-x/', | |
| 'caption' => 'The Facebook API lets you post to Pages you administrate via the API. This tutorial shows you how to achieve this using the Facebook PHP SDK v4.0.x and Graph API 2.x.', | |
| 'message' => 'Check out my new blog post!', | |
| ) ))->execute()->getGraphObject()->asArray(); |
This file contains hidden or 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 | |
| // get page access token | |
| $access_token = (new FacebookRequest( $session, 'GET', '/' . $page_id, array( 'fields' => 'access_token' ) )) | |
| ->execute()->getGraphObject()->asArray(); | |
| // save access token in variable for later use | |
| $access_token = $access_token['access_token']; |
This file contains hidden or 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 | |
| // get like status | |
| $liked = (new FacebookRequest( $session, 'GET', '/me/likes/' . $page_id ))->execute()->getGraphObject()->asArray(); | |
| // if $liked return array with at least one result, user has liked the page | |
| if ( isset( $liked ) && count( $liked ) > 0 ) { | |
| echo '<h2>Liked</h2>'; | |
| } else { | |
| echo '<h2>Not Liked</h2>'; |
This file contains hidden or 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 | |
| // include lines 1-65 from https://gist.github.com/niraj-shah/fcd17411def017e3aefc here | |
| // see if the viewer has liked the page | |
| if ( $pageHelper->isLiked() ) { | |
| // see if we have a session | |
| if ( isset( $session ) ) { | |
| // show logged-in user id |
This file contains hidden or 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 | |
| // required Facebook PHP SDK v4.0.9 or later. | |
| // include required files form Facebook SDK | |
| require_once( 'Facebook/HttpClients/FacebookHttpable.php' ); | |
| require_once( 'Facebook/HttpClients/FacebookCurl.php' ); | |
| require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' ); | |
| require_once( 'Facebook/Entities/AccessToken.php' ); | |
| require_once( 'Facebook/Entities/SignedRequest.php' ); |
This file contains hidden or 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 | |
| // make api call | |
| $response = (new FacebookRequest( | |
| $session, 'POST', '/me/feed', array( | |
| 'name' => 'Facebook API: Posting a Status Update Using PHP SDK 4.0.x', | |
| 'caption' => "I'm rewriting old tutorials to work with the new PHP SDK 4.0 and Graph API 2.0.", | |
| 'link' => 'https://www.webniraj.com/2014/05/29/facebook-api-p…-php-sdk-4-0-x/', | |
| 'message' => 'Check out my new tutorial' | |
| ) |