<pre>
$terms = get_the_terms( get_the_ID(), 'custom_taxonomy' );
<?php foreach( $terms as $term ){
$image = get_field('image', $term->taxonomy . '_' . $term->term_id);
} ?>
</pre>
How to make WordPress theme files writable
Change theme files(.css, .php) permissions to 666.
Path: wp-content/themes/active theme
Don't make everything 777 it's very risky
Owl Carousel on change event
$(document).ready(function(){
var owl = $(".owl-carousel").owlCarousel({
autoplay: true,
autoplaySpeed: 300,
loop: true,
navSpeed: 300,
items: 1,
margin: 2
});
owl.on('changed.owl.carousel', function(e) {
alert("test");
});
});
Magento 2.4.1 admin page showing blank
1. Need to update code in Validator.php
2. Path: vendor\magento\framework\View\Element\Template\File
3. Replace line no 138 like below
$realPath = $this->fileDriver->getRealPath($path); replace with $realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
Run below commends.
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento indexer:reindex
Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. And Wrong file In Gd2.php in Magento 2.4.1
Add extra condition, please edit below function on line no 90 follow this- vendor\magento\framework\Image\Adapter\Gd2.php
private function validateURLScheme(string $filename) : bool { $allowed_schemes = ['ftp', 'ftps', 'http', 'https']; $url = parse_url($filename); if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) { return false; } return true; }
Remove admin menu from WordPress dashboard
add_action('admin_init', 'custom_remove_admin_page'); if(!function_exists('custom_remove_admin_page')) { function remove_admin_page($needle) { if(isset($GLOBALS[ 'menu' ]) && !empty($GLOBALS[ 'menu' ]) && !empty($needle)) { $needle = strtolower($needle); $needle = trim($needle); foreach($GLOBALS[ 'menu' ] as $position => $items) { foreach($items as $key => $item) { if(strtolower($item) == $needle) { remove_menu_page( $items[2] ); } } } } } }
Check click target using jQuery
$(document).click(function(event){ $target = $(event.target); if(!$target.closest('.div-content').length){ alert('outside'); }else{ alert('inside'); } });
Change date format in WordPress comments
add_filter( 'get_comment_date', 'aviweb_comment_date' ); function aviweb_comment_date( $date ) { $date = date("d/m/Y"); return $date; }
How can I fix RevSlider Fatal error in dashboard after upgrading to PHP 7
Please update below code in plugin file. It’s temporary solution only, you need to contact plugin support team.
path: revslider/includes/framework/base-admin.class.php private static $arrMetaBoxes = ''; to private static $arrMetaBoxes = array();
Get radio button value on change
var radio_data = $('input[name="gender"]').change(function () { var value = radio_data.filter(':checked').val(); alert(value); });