kprajapati22
Forum Replies Created
-
WordPress prefers that use of existing API instead of direct database queries. You can rewrite the code as below. I have added caching code for db exists and added phpcs:ignore for DirectQuery error.
// Create database tables
function ikr_js_db_connection() {
global $wpdb;
// Table prefixes
$table_name_1 = $wpdb->prefix . 'ikr_leaflet_js_db';
$table_name_2 = $wpdb->prefix . 'ikr_default_setting';
$charset_collate = $wpdb->get_charset_collate();
// Define a cache key for this specific check
$cache_key = 'ikr_leaflet_js_db_exists';
// Try to get the cached result first
$table_exists_1 = wp_cache_get( $cache_key );
if ( false === $table_exists_1 ) {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
$table_exists_1 = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table_name_1 ) );
// Cache the result to avoid future database hits
wp_cache_set( $cache_key, $table_exists_1 );
}
// Create table 1 if it doesn't exist
if ( $table_exists_1 ) {
$sql = "CREATE TABLE $table_name_1 (
id INT(10) NOT NULL AUTO_INCREMENT,
lat VARCHAR(100) NOT NULL,
lng VARCHAR(100) NOT NULL,
address VARCHAR(100) NOT NULL,
phone VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL,
urls VARCHAR(1000) NOT NULL,
marker_id VARCHAR(100) NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
// Insert default data using prepared statements
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
$wpdb->insert(
$table_name_1,
array(
'lat' => 23.8536047088421,
'lng' => 89.24606323242189,
'address' => '2',
'phone' => '100',
'email' => '300',
'urls' => 'https://hamjaiu.com',
'marker_id' => '88759345',
)
);
}
// Do same for table 2
}
// Call the function to create/update tables
ikr_js_db_connection();Forum: Fixing WordPress
In reply to: Navigation, Breadcrumb, and Footer Missing on Specific PostSure. Please share backend screenshot of both working and not working post.
Forum: Fixing WordPress
In reply to: Otter template not viewing properlyClick on customize under appearance menu in the background. It will open WordPress customizer. Then go to custom css option and add the code I provided
Forum: Fixing WordPress
In reply to: Navigation, Breadcrumb, and Footer Missing on Specific PostIt seems to be different template applied to this post. please check template is same as other post. The post which works has this elements but the post which is not working doesn’t have this elements.
- This reply was modified 1 month, 2 weeks ago by kprajapati22.
Forum: Fixing WordPress
In reply to: No items on mobile hamburger menuI saw that, on click of hamburger menu, it does add show class but then doesn’t remove on second click. Also, there are few CSS which needs to be added for show class.
You need to add following custom JavaScript and CSS code to make it work
JavaScript Codedocument.getElementById('header-nav').addEventListener('click', function() {
const toggleDiv = document.getElementById('header-responsive-inner');
toggleDiv.classList.toggle('show');
});CSS Code
.nav-collapse.collapse.show {
height: auto;
visibility: visible;
}Forum: Fixing WordPress
In reply to: Otter template not viewing properlyYou need to add height to the left column. Try following CSS to look like https://prnt.sc/M2O0kDgTgao-
#wp-block-themeisle-blocks-advanced-column-0a67918a {
height: 100%;
}Any updates?
Forum: Plugins
In reply to: [Javascript HTML Text Adder] Preview works, but not the sideviewclosing the ticket now
Forum: Plugins
In reply to: [Javascript HTML Text Adder] Unable to Save Javascript to Widgetcan you provide sample code you are using? so i can try on my side
Forum: Plugins
In reply to: [Javascript HTML Text Adder] Preview works, but not the sideviewHi,
have you entereed direct <script> tag code?. can you please provide clear description so i can help you
Thanks,
KalpeshForum: Plugins
In reply to: [Javascript HTML Text Adder] Javascript does not work – Amazon created widgetOkay. sounds good. Let me know if you need any other help
Regards,
KalpeshForum: Plugins
In reply to: [Javascript HTML Text Adder] Plugin not working in new templateHi Bernadette,
I have checked this on my site and its working perfect for me. If you still have problem then let me know in details with screenshot link so i provide you solution
Thanks,
KalpeshIf you connect to proxy server then you need to configure it on your wp-config.php
/** EXAMPLE – proxy settings */
define(‘WP_PROXY_HOST’, ‘proxy.url.com’);
define(‘WP_PROXY_PORT’, ‘1234’);
define(‘WP_PROXY_USERNAME’, ”);
define(‘WP_PROXY_PASSWORD’, ”);
define(‘WP_PROXY_BYPASS_HOSTS’, ‘localhost’);SOLVED
in my case, it was simply the SITE URL left blank in Settings -> General
Filled with mu site URL, everything started working again.i found out enabling WP_DEBUG in wp-config.php, and i got this error:
“Notice: Undefined index: host”If still not solved then there is issue with your server configuration.
Forum: Installing WordPress
In reply to: How to add My Profile Picture