WordPress Appointkart plugin issue in iphone device - wordpress

When plugin page load then by default open calendar. So how I hide the by default open calendar.
in Iphone page load calander open. website link

You have :
$(document).ready(function() {
$('#hide_cal').delay(8000).fadeIn(400);
});
buried at the end of:
/wp-content/plugins/appointkart/assets/js/jquery.pickmeup.js
Something like that doesn't even belong in the plugin file. Perform all initiation in a separate js file.

Related

I'm trying to add a popup modal to my WordPress website but in is not working

I'm trying to add a popup modal to my WordPress website, for this, I added custom elementor code, and the code is executed properly in preview but not working on the live website.
It shows an error in inspect :
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('') does not match the recipient window's origin ('').
[Intervention] Images loaded lazily and replaced with placeholders. Load events are deferred. See https://go.microsoft.com/fwlink/?linkid=2048113
I used JQuery instead of $ and it works
jQuery(document).ready(function($){
// jQuery code is in here
});

How to remove the hole MediaLibrary Tab from Media Uploader in Wordpress

I created a custom button for uploading images to wordpress media. How to hide the hole "mediaLibrary" Section in the Media Upload Modal?. I tried the following code which only removes the tab title not the hole tab. There are a lot of answers claiming that the following removes the tab - but it only removes the tab title. Any idea how to solve this issue?
Following code only removes the tab title
function remove_medialibrary_tab($tabs) {
if ( current_user_can( 'administrator' ) ) {
unset($tabs["mediaLibraryTitle"]);
}
return $tabs;
}
add_filter('media_view_strings', 'remove_medialibrary_tab');
Some visual to make it clear for everyone
Remove the following section
Keep the following section
I'm making a support feature plugin where the user is only allowed to upload media to custom post. The attached media will then be displayed in a metabox along with a button that opens the media uploader. So, I have the same problem: I only want the "Upload files" tab and no ability to select existing media via the "Media Library" tab.
First, I don't have to do any extra work to attach the file to the post provided I pass the post ID during admin_enqueue_scripts enqueuing of the media library:
wp_enqueue_media(array(
'post' => isset($_GET['post']) ? $_GET['post'] : NULL,
));
Second, I attach a listener to the media library on it's opening to hide the "Media Library" tab and to activate the "Upload files" tab and display its contents (this is javascript that acts on the object created by wp.media({})):
my_frame.on('open', function(){
jQuery(".media-menu-item#menu-item-browse").hide();
jQuery(".media-menu-item#menu-item-upload").trigger('click');
});
Lastly, when the user uploads a file, the Media Uploader displays the "Media Library" content and awaits the user to select that media. The point is to hide the "Media Library" content so displaying it after upload completely defeats the purpose. When I first read this answer over a week ago, I had no idea what to do. Today, I ran across a freakishly weird javascript trigger that is called {region}:activate:{mode} (yeah, I know).
my_frame.on('content:activate:browse', function(){
my_frame.close();
});
The "content" region is the main viewport under the tabs. When that region changes, it go through a series of triggers (one being "activate"). The stuff displayed in the viewport is the mode: "browse" is the mode for the "Media Library" tab; and "upload" is the mode for the "Upload files" tab). And, that's how the trigger fired when the content of the Media Library is displayed gets its name (content:activate:browse).
When you switching to media library tab, starts ajax query for load attachments. You can try add this action with 1 priority.
function restrict_non_Admins(){
if(!current_user_can('administrator')){
exit;
}
}
add_action('wp_ajax_query-attachments', 'restrict_non_Admins', 1);
add_action('wp_ajax_nopriv_query-attachments', 'restrict_non_Admins', 1);
Also you can hide tab with css or remove html with js.

Google Maps Embed Api In Wordpress: Server Rejected Your Request

I've been up half the night on this issue . I've embedded a google map API via iframe into a Wordpress site and I get the error: The Google Maps API server rejected your request. The provided API key is invalid.
Nothing is wrong with my key. I put it in a vanilla html document outside of wordpress and it works great.
Then I've tried setting the sensor to true in the header.php.
No difference except more errors from my console:
Failed to load resource:
https://www.google.com/maps/embed/v1/place?q=place_id:myplacekey=mykey?wmode=transparent Failed to load resource: the server responded with a status of 403 ()
**Can't post the rest because I need more reputation
I believe the issue is with the ?wmode=transparent being appended to the end of the key. What might be adding that and how can I remove it?
The problem is in your theme.
When you look at the page with the map in browser inspector (Elements tab), you can see that link is ended by ?wmode=transparent
Code of the page does not contain ?wmode=transparent, you can see it on Sources tab of inspector:
This means that code of the page is modified by some js script. Browsing scripts in Sources tab, I had found the following:
At line 13 you can see source of your problem. This is some action for Youtube video, which was done by developers with a rough mistake. They add ?wmode=transparent to src of ANY iframe, including Google maps.
I have checked the latest version of theme. Same bug.
What you have to do: just comment line #13 in the file /wp-content/themes/crescent-theme/js/jquery.custom.js and make it like this:
( function( $ ) {
function modifyPosts() {
/* Fit Vids ---------------------*/
$('.feature-vid, .postarea').fitVids();
}
//Fix z-index youtube video embedding
$(document).ready(function (){
$('iframe').each(function(){
var url = $(this).attr("src");
// $(this).attr("src",url+"?wmode=transparent");
});
});
$( document )
.ready( modifyPosts )
.on( 'post-load', modifyPosts );
})( jQuery );
If you will update theme, you have to comment similar line in the same js file.

Wordpress: Simple solution to have mobile devices load a different homepage

I have done quite a bit of googling and have not found a simple solution for a method or a plugin to simply load a different static homepage for mobile devices. Is there a way to do this or a plugin that will do this (without revamping the whole site for mobile devices, as the mobile site style is good, but the specific static homepage is the only thing that I need changed). Wordpress CMS is the platform.
Thanks in advance!
Update:
So I installed the plugin suggested below, copied over an exact copy of the theme I am using but named it with 'mobile' in front just for reference, other than that everything is exactly the same. I read via google that I could add the following code into the functions.php theme file but it just shows up blank when I add the specific code. Code:
//Set Homepage
$mobilehome = get_page_by_title( 'mobilehome' );
update_option( 'page_on_front', $mobilehome->ID );
update_option( 'show_on_front', 'page' );
// Set the blog page
$blog = get_page_by_title( 'Blog' );
update_option( 'page_for_posts', $blog->ID );
Update 2, solved.
I found a simple solution. I created a new theme file 'page-home.php' and changed the css class '#primary' to '#primary-home', then went into the style.css file and added all '#primary-home' css attributes to match '#primary', except on the mobile CSS area of the stylesheet, I added "display:none;" to #primary-home. So now it just doesn't display the homepage on mobile devices, all other pages work (whole point in making the new template page and CSS attribute). I know this fix is probably the simple easy fix but it worked for me!
I found a simple solution. I created a new theme file 'page-home.php' and changed the css class '#primary' to '#primary-home', then went into the style.css file and added all '#primary-home' css attributes to match '#primary', except on the mobile CSS area of the stylesheet, I added "display:none;" to #primary-home. So now it just doesn't display the homepage on mobile devices, all other pages work (whole point in making the new template page and CSS attribute). I know this fix is probably the simple easy fix but it worked for me!
I think that this is as simple as it could get:
Try this plugin - UserAgent Theme Switcher
It will use the user-agent to detect which browser you are on, in this case it could be something like mobile safari or android, etc... then serve the theme based on that.
This could be a hit or miss because you might want or not to change the theme. A more advanced way to do this would be to use a jQuery plugin that checks for the user agent and lets you "do stuff" after you detect it, in this case it could serve as another page or change some CSS.
It's easy and no need to code everything. Install "Redirection" plugin from wordpress repository.
Go to the settings page.
Enter the "Source URL" with your default desktop's homepage
On the "Match" option, select "URL and user agent" & on the "Action" option select "Redirect to URL". Click "Add Redirection".
New configuration option will be appeared. Give any title you want. The "Source URL" must be blank (means that is your base homepage). On the "User Agent" option, choose whether iPhone or Android. On the "Matched" option, set the redirection you want for the mobile homepage.
Done!
You surely can differentiate the homepage on desktop and mobile device based on the redirection you have set before with that plugin. However, you cannot have same url name (ex: www.abcde.com for desktop & www.abcde.com/mobilehomepage for mobile device).

mobile to main site redirect

I want to switch my mobile site to main site. remember when you open facebook on mobile then view of facebook in mobile version is change and when you click on "Go to main site" then it appears main site in mobile. that i want.
And also main problem is both links are same means
main site url is http://www.yousite.com
mobile site url is http://www.yousite.com
when you open in mobile then mobile template is show and when i open is desktop then main site template is show.
I've done this on a previous version of my site and wrote about it here: http://arleym.com/mobile-device-detection-redirection/
Basically I have some device detection that will be ignored if there is a query string. So the "view desktop version" link will avoid the detection/redirection and give the user a cookie.
I used this detection script: http://detectmobilebrowsers.mobi/
and modified my switch like so:
<?php
if(isset($_GET['switch'])){
setcookie('switch',$_GET['switch']); // set a cookie
}
if(!isset($_GET['switch']) && !isset($_COOKIE['switch'])){
require_once('/server/path/arleym.com/mobile_device_detect.php'); //Andy Moore's script
mobile_device_detect(true,false,true,true,true,true,true,'
http://arley.me',false);
}
?>
The view desktop url simply does its thing like href="http://whatever.com?switch=0"

Resources