<pre>
It's a permission issue.
Sudo chmod 777 /opt/lamp/htdocs/joomla/administrator/cache
</pre>
Author: Avinash Konanki
Unset post taxonomy in the wordpress with post id
<pre>
$terms = get_the_terms( post_id, 'taxonomy' );
if ($terms) {
foreach($terms as $term) {
wp_remove_object_terms( $line[0], $term->slug, 'taxonomy' );
}
}
</pre>
OWL slider trigger based on count
Please find below code
var count = 2
var duration = 500;
jQuery('.owl-slider').trigger('to.owl.carousel', [count, duration, true]);
Remove query params from url without reload
<script>
jQuery(document).ready(function(){
window.history.replaceState(null, null, window.location.pathname);
});
</script>
HTML button for Google Calendar
<a href="https://calendar.google.com/calendar/render?action=TEMPLATE&text=Avi Web Event&details=Event details&dates=20220720T053000/20220725T073000&location=Online" target="_blank">Add to Calendar</a>
OWL carousel items overlapping
.owl-carousel .animated {
-webkit-animation-duration: 20ms;
animation-duration: 20ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
How to create a custom table using custom code in WordPress?
global $wpdb;
global $charset_collate;
$table_name = $wpdb->prefix . 'custom_table';
$sql = "CREATE TABLE IF NOT EXISTS $table_name (
`ID` int(20) NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
`mobile_number` varchar(200) NOT NULL,
`email` varchar(20) NOT NULL,
PRIMARY KEY (`ID`)
)$charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
CF7 failed to load resource: the server responded with a status of 409 ()
<pre>
Add below code in function.php
add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );
</pre>
Update custom taxonomy post number limits
<pre>
function aviweb_change_posts_per_page( $query ) {
if (is_tax( 'custom_taxonomy' ) ) {
$query->set( 'posts_per_page', 3 );
}
}
add_filter( 'pre_get_posts', 'aviweb_change_posts_per_page' );
</pre>
Validate URL using jQuery
var url = "https://avinashkonanki.com/";
var url_validate = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
if(!url_validate.test(url)){
alert('error');
}
else{
alert('success');
}