Skip to content

Instantly share code, notes, and snippets.

git remote set-url origin git@bitbucket.org:-----add new url form git/bitbucket
$imageContent = get_the_content();
$stripped = strip_tags($imageContent, '<p> <a>'); //replace <p> and <a> with whatever tags you want to keep after the strip
echo $stripped;
/**
* add mobile version of logo
*/
function mobile_logo_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'logo_mobile' ); // Add setting for logo uploader
// Add control for logo uploader (actual uploader)
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'logo_mobile', array(
'label' => __( 'Logo (mobile version)', 'm1' ),
'section' => 'title_tagline',
/**
* remove custom logo classes
*/
function helpwp_custom_logo_output( $html ) {
$html = str_replace('custom-logo-link', 'navbar-item is-hidden-touch', $html );
$html = str_replace('custom-logo', 'logo-main', $html );
return $html;
}
add_filter('get_custom_logo', 'helpwp_custom_logo_output', 10);
ADDING CUSTOM POST TYPE
add_action('init', 'all_custom_post_types');
function all_custom_post_types() {
$types = array(
// News and Events
array('the_type' => 'premier-league',
'single' => 'Fantasty Premier league',
<?php while( have_posts() ) : the_post(); ?>
<?php if( ! empty( $post->post_title ) ) : ?>
<h1><?php the_title(); ?></h1>
<?php endif; ?>
<?php endwhile; ?>
if( '' !== get_post()->post_content ) {
// do something
}
// credit goes to https://wordpress.stackexchange.com/questions/121359/if-the-post-has-content
@eyecandy91
eyecandy91 / Wordpress: Do if the_content is not empty
Created March 31, 2019 11:27 — forked from bhongy/Wordpress: Do if the_content is not empty
Wordpress: Check if the_content is empty / do something only when the_content is empty
<?php
$thecontent = get_the_content();
if(!empty($thecontent)) { ?>
// do or output something
<?php } ?> // break php tag for HTML block
@eyecandy91
eyecandy91 / wordpress custom post types
Created June 18, 2018 11:31
Wordpress custom multiple post type
// ADDING CUSTOM POST TYPE
add_action('init', 'all_custom_post_types');
function all_custom_post_types() {
$types = array(
// News and Events
array('the_type' => 'premier-league',
'single' => 'Fantasty Premier league',
@eyecandy91
eyecandy91 / js
Created May 25, 2018 05:25
Pause all videos js
<script type="text/javascript">
$(".pause-videos").click(function(){
var stopAllYouTubeVideos = () => {
var iframes = document.querySelectorAll('.booking-forms iframe');
Array.prototype.forEach.call(iframes, iframe => {
iframe.contentWindow.postMessage(JSON.stringify({ event: 'command',
func: 'pauseVideo' }), '*');
});
}
stopAllYouTubeVideos();