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
.wp-block-gallery label { | |
cursor: pointer; | |
} | |
.gallery-item-modal, | |
input[type="checkbox"] { | |
display: none; | |
} | |
input[type="checkbox"]:checked + .gallery-item-modal { | |
display: flex; | |
} |
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 | |
add_action('init', function() { | |
register_block_type('core/gallery', array( | |
'render_callback' => function($attributes, $content) { | |
$items = count($attributes['ids']); | |
$new_content = "<figure class='wp-block-gallery columns-{$items}'><ul class='blocks-gallery-grid'>"; | |
foreach($attributes['ids'] as $idx => $attachment_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 | |
$msg = ''; | |
// Remove custom user role and assign all users with this role to subscibres. | |
if (!empty($_GET)) { | |
if (!empty($_GET['del'])) { | |
$users = get_users(['role__in' => [esc_attr($_GET['del'])]]); |
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 | |
$options = [ | |
'parent' => '', | |
'name' => 'Child Theme', | |
'description' => 'Enter child theme description...', | |
'screenshot' => '', | |
'bootstrap' => false | |
]; |
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
:root { | |
--primary: #0073aa; | |
--white: #ffffff; | |
--lightgrey: #f2f1f1; | |
} | |
.grid { | |
align-items: flex-start; | |
display: grid; | |
grid-gap: 1rem; | |
grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); |
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 $bloggers = get_users(['role__in' => ['author', 'subscriber']]);?> | |
<div class="grid"> | |
<?php foreach($bloggers as $user):?> | |
<user-card name="<?php echo $user->display_name;?>" avatar="<?php echo get_avatar_url($user->ID, array('size' => 512));?>"> | |
<div slot="email"><?php echo $user->user_email;?></div> | |
<div slot="url"><?php echo $user->user_url;?></div> | |
<div slot="bio"><?php echo $user->user_description;?></div> | |
</user-card> | |
<?php endforeach;?> |
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: Blogger Cards | |
Plugin URI: https://ctrls.dev/ | |
Description: Create blogger cards plugin using WordPress and Web Compoments. | |
Version: 0.0.1 | |
Author: Krasen Slavov | |
Author URI: https://krasenslavov.com/ | |
License: GNU General Public License, version 2 | |
License URI: https://www.gnu.org/licenses/gpl-2.0.html |
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 | |
add_action('manage_posts_columns', function($columns) { | |
$columns['bitly_url'] = 'Bitly URL'; | |
return $columns; | |
}, 10, 1); | |
add_action('manage_posts_custom_column', function($column, $post_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 | |
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); | |
add_action('wp_head', function() { | |
global $post; | |
$short_url = get_post_meta($post->ID, 'bitly_url', true); |
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 | |
add_action('publish_post', function ($post_id) { | |
global $wpdb; | |
$api_key = 'GENERATED_ACCESS_TOKEN'; | |
$api_url = 'https://api-ssl.bitly.com/v4/bitlinks'; | |
$data = array( |