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 | |
/** | |
* Partial template for content in page.php | |
* | |
* @package UnderStrap | |
*/ | |
// Exit if accessed directly. | |
defined( 'ABSPATH' ) || exit; |
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_key = 'YOUR_API_KEY'; | |
$url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'; | |
$pattern = '/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/'; | |
preg_match($pattern, $url, $matches); | |
$video_id = $matches[7]; | |
$url = "https://www.googleapis.com/youtube/v3/videos?id=$video_id&key=$api_key&part=snippet"; |
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
sudo docker-compose exec mariadb mysqldump -uwordpress -pwordpress wordpress > ./dump.sql |
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
$ sudo apt install pdftk [On Debian, Ubuntu and Mint] | |
$ sudo yum install pdftk [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] | |
$ sudo emerge -a app-text/pdftk [On Gentoo Linux] | |
$ sudo apk add pdftk [On Alpine Linux] | |
$ sudo pacman -S pdftk [On Arch Linux] | |
$ sudo zypper install pdftk [On OpenSUSE] | |
$ pdftk <path-to-protected-filename>.pdf input_pw <yourpassword> output <path-to-newfilename>.pdf |
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 | |
function custom_search_filter( $query ) { | |
global $wpdb; | |
if ( $query->is_search() && ! is_admin() ) { | |
$search_query = get_search_query(); | |
$results = $wpdb->get_results( | |
$wpdb->prepare( | |
"SELECT p.ID, p.post_title, m.meta_value | |
FROM {$wpdb->prefix}posts AS p |
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
.thumb { | |
position: relative; | |
&:before { | |
display: block; | |
content: ""; | |
width: 100%; | |
// aspect-ratio: 16 / 9; | |
padding-top: (9 / 16) * 100%; | |
} |
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 | |
$terms = []; | |
$args = [ | |
'post_type' => 'your_post_type', // change this | |
'tax_query' => [ | |
[ | |
'taxonomy' => 'your_taxonomy', // change this | |
'terms' => $terms |
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 | |
// Utility data | |
$is_enrolled = apply_filters( 'tutor_alter_enroll_status', tutor_utils()->is_enrolled() ); | |
$lesson_url = tutor_utils()->get_course_first_lesson(); | |
$is_privileged_user = tutor_utils()->has_user_course_content_access(); | |
$tutor_course_sell_by = apply_filters( 'tutor_course_sell_by', null ); | |
$is_public = get_post_meta( get_the_ID(), '_tutor_is_public_course', true ) == 'yes'; | |
// Monetization info | |
$monetize_by = tutor_utils()->get_option( 'monetize_by' ); |
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 | |
// Add term and conditions check box on registration form | |
add_action( 'woocommerce_register_form', 'add_terms_and_conditions_to_registration', 20 ); | |
function add_terms_and_conditions_to_registration() { | |
if ( wc_get_page_id( 'terms' ) > 0 && is_account_page() ) { | |
?> | |
<p class="form-row terms wc-terms-and-conditions"> | |
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox"> |
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 | |
function custom_add_message_login_form() { | |
echo '<div class="form-login-message">'; | |
echo 'Ao fazer login, você concorda com os <a href="">termos de serviço</a> e <a href="">política de privacidade</a> da <a href="' . home_url() . '">Escola</a>'; | |
echo '</div>'; | |
} | |
add_action( 'woocommerce_login_form_end', 'custom_add_message_login_form', 99 ); |