(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<?php | |
/** | |
* set /?do=now at the end of site your URL to fire this script. | |
*/ | |
/** | |
* Function return attachment data needed for s3 table upload. | |
* | |
* @return array $attachment_data_array Attachment data array. | |
*/ |
<?php | |
function get_attachments_s3_array() { | |
global $wpdb; | |
$table_name = $wpdb->prefix . 'rtamazon_s3_media'; | |
$query = "Select * from ".$table_name." where s3_url IS NULL AND media_id=83"; | |
$attachment_data = $wpdb->get_results($query,OBJECT); | |
$final_attachment_data = array(); | |
if(!empty($attachment_data)){ | |
foreach ($attachment_data as $key => $value) { | |
$single_attachment_data['blog_id'] = 1; |
<?php | |
function get_attachments_s3_array() { | |
global $wpdb; | |
$table_name = $wpdb->prefix . 'rtamazon_s3_media'; | |
$query = "Select * from ".$table_name." where s3_url IS NULL AND media_id=83"; | |
$attachment_data = $wpdb->get_results($query,OBJECT); | |
$final_attachment_data = array(); | |
if(!empty($attachment_data)){ | |
foreach ($attachment_data as $key => $value) { | |
$single_attachment_data['blog_id'] = 1; |
<?php | |
/** | |
* Function to add Album menu as main menu in WordPress Profile menu. | |
*/ | |
if ( ! function_exists( 'rtmedia_add_album_main_menu' ) ) { | |
function rtmedia_add_album_main_menu() { | |
// Please change the page_slug if you want from here | |
$page_slug = 'album'; | |
$page_title = __('Album','buddypress-media' ); | |
// check if RTMEDIA_MEDIA_SLUG is already defined |
<?php | |
add_action('init','rtmedia_disable_media_like_init'); | |
/** | |
* Function to extend like disable check functionality. | |
*/ | |
function rtmedia_disable_media_like_init(){ | |
if( function_exists( 'rtmedia_disable_own_media_like' ) ) { | |
add_filter( 'rtmedia_check_enable_disable_like','rtmedia_disable_own_media_like' , 10, 1 ); | |
} | |
} |
<?php | |
/** | |
* Function will exclude all rtMedia uploaded media from backend media tab. | |
*/ | |
function show_only_allowed_media( $query ) { | |
global $wpdb, $pagenow; | |
if ( $query->is_admin ) { | |
if('upload.php' === $pagenow || ( !empty($_REQUEST['action']) && 'query-attachments' === $_REQUEST['action']) ){ | |
$wp_rt_rtm_media = $wpdb->prefix."rt_rtm_media"; | |
$custom_query = "select media_id from ".$wp_rt_rtm_media; |
add_action( 'admin_notices','bp_admin_notices' ); | |
/** | |
* Add Admin Notice when BuddyPress is not activated. | |
*/ | |
public function bp_live_admin_notices( ){ | |
if( ! is_plugin_active('buddypress/bp-loader.php') ){ ?> | |
<div class="notice notice-warning is-dismissible"> | |
<p> | |
<?php _e( 'BuddyPress Live Notification required BuddyPress to be activated', 'bp_live_notification' ); ?></p> |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<?php | |
/** | |
* Adds and controls pointers for contextual help/tutorials | |
* | |
* @author WooThemes | |
* @category Admin | |
* @package WooCommerce/Admin | |
* @version 2.4.0 | |
*/ |
<?php | |
/** | |
* create a file acf-import.json inside your theme main folder | |
* use this code in themes functions.php or in any custom plugin. | |
* It is one time code so it will add all fields json entry inside acf-import.json file | |
*/ | |
add_action('init', 'create_fieldjson_from_fieldphp'); | |
function create_fieldjson_from_fieldphp() { | |
$groups = acf_get_local_field_groups(); | |
$json = []; |