Remove pretty photo style and script if not exist wordpress - actionscript-3

I need to dequeue or remove style and script related to "pretty_photo" from my theme but load it again only when it called or needed
i have this code in my functions.php
wp_enqueue_style('pretty_photo',
MASTER_THEME_DIR . '/addons/prettyphoto/prettyPhoto.css',
array(), false, 'all');
please someone help me.
Thank you!

I get it to work finally .. The code is:
add_action( 'wp_enqueue_scripts', 'pretty_photo_styles', 100 ); function pretty_photo_styles() { if ( ! is_single() ) { wp_dequeue_script( 'pretty_photo' ); wp_dequeue_style( 'pretty_photo' ); }}
Please someone correct it if i missed anything! i tried it and it worked for me.
Thank you all.

Related

Do i need to remove this wp-block-library-css (Gutenberg CSS)?

I just want some clarification and advice regarding this tag in WordPress.
This tag is showing in my WordPress head even I'm not using Gutenberg.
link rel="stylesheet" id="wp-block-library-css"
Is this necessary or required?
Do I need to remove this to improve page speed?
Is there any effect if I remove this tag?
Please enlighten me.
Thank you
I use to remove this stylesheet on websites which are not using Gutenberg.
I don't think there is other effect than removing this stylesheet, you can do it safely.
To go a bit further, you can remove it only for some post types like
function remove_wp_block_library_css() {
if( !is_singular('post') ) {
wp_dequeue_style( 'wp-block-library' );
}
}
add_action( 'wp_enqueue_scripts', 'remove_wp_block_library_css' );
If you are not using Gutenberg at all, you can unload styles further more like this :
// Unload Gutenberg-related stylesheets.
add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
function remove_block_css() {
wp_dequeue_style( 'wp-block-library' ); // Wordpress core
wp_dequeue_style( 'wp-block-library-theme' ); // Wordpress core
wp_dequeue_style( 'wc-block-style' ); // WooCommerce
wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
}

How to fix the issues when I update wordpress in php 7

please help me to fix.
I have updated the PHP 5.6 to php7.3.
But the WordPress sites don't work well.
As you can see, the new site's below is not working despite the same code and the same database.
I have replaced the '& new' to 'new' based on the StackOverflow's answer. I appreciate if you give me the answer. Thanks.
Thanks.
I added some codes in the wp-config.php
ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
And I updated the customLoop function in the PeThemeContent.php
public function customLoop($type,$count = 10,$tax = null,$custom = null,$paged = false) {
$args = $this->getPostsQueryArgs($type,$count,$tax,$custom,$paged);
if ($this->current) {
$this->loops[] = $this->current;
}
$this->master->data->postSave();
$this->current = new WP_Query($args);
return $this->current->post_count > 0;
}
So, the issue is solved.

Add default code in wordpress post

I want to add a simple code to all new post by default
I tried to used this code in .function.php (wpbeginner)
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "If you like this post, then please consider retweeting it or sharing it on Facebook.";
return $content;
}
I am using plugin named Shortcodes Ultimate
Code:
[su_spoiler title="Download The File" style="fancy" icon="chevron-circle"]Here[/su_spoiler]
I tried to normal use simple html and CSS code but it show the same error for both cases
https://i.stack.imgur.com/wgAs4.png
Try this -: wrap your code is a single quote as you are already using double quotes.
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = '[su_spoiler title="Download The File" style="fancy" icon="chevron-circle"]Here[/su_spoiler]';
return $content;
}

How to remove MediaWiki Help Link from page

Please, how can I remove this link from my MediaWiki Special Page?
You need to override SpecialPage::addHelpLink() in your special page class. You could either add a different help link, or just not add one at all.
Check out
languages/i18n/en.json
Line [ 233 ]
I found it:
public function addHelpLink( $to, $overrideBaseUrl = false ) {
global $wgContLang;
$msg = $this->msg( $wgContLang->lc( $this->getName() ) . '' );//-helppage
if ( !$msg->isDisabled() ) {
$helpUrl = Skin::makeUrl( $msg->plain() );
$this->getOutput()->addHelpLink( $helpUrl, true );
} else {
$this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
}
}
I'd just removed -helppage from SpecialPage Class.

Output post for second wordpress editor

I recently added a new editor to all my pages and posts admin area with the Wordpress 3.3 new feature to do this
add_action( 'edit_page_form', 'my_second_editor' );
function my_second_editor() {
// get and set $content somehow...
wp_editor( $content, 'mysecondeditor' );
}
My question is how do I output what I enter in this second editor on my website/page? Do I need to make a custom loop? The codex is not very helpful unfortunately.
Thanks
You'll need get_post_meta(), use it like:
echo get_post_meta(get_the_id(), 'mysecondeditor');
Read more: http://codex.wordpress.org/Function_Reference/get_post_meta
To save the data entered in your second editor you'll need this code in your functions.php file:
add_action( 'save_post', 'save_post', 10, 2 );
function save_post( $post_id, $post ) {
if ( !current_user_can( 'edit_post', $post_id ) )
return $post_id;
update_post_meta( $post_id, 'mysecondeditor', stripslashes( $_POST['mysecondeditor'] ) );
}
So after that he's the full code for your second editor:
wp_editor( get_post_meta(get_the_id(), 'mysecondeditor', true), 'mysecondeditor' );
The true above makes sure only a single variable is returned and not an array so you can use it right away.
user2019515I's (Apr 18 '13 at 12:06) answer works for me, I can add text and gallery, but when I display that with this code:
<?php echo get_post_meta(get_the_ID(),'mysecondeditor')['0']; ?>
I got gallery code instead of the images, so:
mytext [gallery ids="102,62"]
How could I display the text (mytext) and the images too?