I currently doing a WordPress Plugin and I am successful when I try to put CSS or JavaScript on the frontend but I don't know on where I fail when I trying to do the same on backend side, this is my code: function my_function($hook) { global $post; if($hook == 'post-new.php' || $hook == 'post.php') { if($post->post_type == 'post_type_name') { wp_enqueue_style('adminCSS', plugins_url('../assets/css/admin.css', __FILE__) ); } } } add_action( 'admin_enqueue_scrips', 'my_function'); As you see on my code I only want the …
okay i have made my own rewrite rule, with the add_rewrite_rule function in wordpress to get a custom url, for an plugin page. add_action( 'init', function() { add_rewrite_rule( 'login/?$', 'index.php?function=login', 'top' ); add_rewrite_rule( 'login/([a-zA-Z0-9]+)/?$', 'index.php?function=login&id=$matches[1]', 'top' ); }); add_filter( 'query_vars', function($query_vars) { $query_vars[] = 'function'; $query_vars[] = 'id'; return $query_vars; }); This works great and i can visit the page [domainname.com]/login to visit the page. Now the problem how do i best get a propper permalink for this page, one …
I need to send information to the plugin folder via ajax. Wordpress has a function for the link "plugin_dir_url (__ FILE__)" which works properly but if I put it in ajax it doesn't work. Function: plugin_dir_url (__ FILE__) = http: // localhost / aa / wp-content / plugins / pluginfolder / This works normally: var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { } }; xmlhttp.open("GET", "http://localhost/aa/wp-content/plugins/pluginfolder/wp-getinfo.php?"&SENDINFO=sendinfo, true); xmlhttp.send(); This does …
I'm trying to figure out a simple way to "grab current URL" and use mailto link such as: <a href="mailto:email.com?subject=Booking%20Request%20%value%&body=Hello%20Daisy%2C%0A%0AI'm%20interested%20in%20booking%20%value%%20for%202%20hours%20on%20this%20date%20%5Benter%20date%5D%20and%20this%20address%20%5Benter%20address%5D.%0A%0AI%20plan%20on%20doing%20the%20following%20activity%20%5Benter%20activity%5D.%0A%0ARegards%2C%0A%0A%5Benter%20your%20name%5D">Request Booking</a> The above is the mailto link I've created. I've stumbled upon the below to grab the URL: global $wp; $current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) ); My question is how do I incorporate the above URL grabbing code into usable html code? Or perhaps there is a plugin I can use that will inject the current URL …
I am reading the conversation about WP_USE_THEMES and I don't understand the term 'URL parsing'. Can someone please explain that to me in the context of Wordpress ? Google didn't produce significant results.
How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash). I manage to remove the category base using the "WP No Category Base" plugin but I need to add a forward slash on the category URL. Examples: www.example.com/es <- this is a category (needs a forward-slash '/') www.example.com/es/hola.html <- this is a post so, it's ok, no changes …
I have a straightforward question: How do I change the links (base URL) of the JS and CSS assets provided by WooCommerce (or any other plugin) in order to use a CDN? The only requirements I have: I do not want to use any plugin. I do not want to change any code in wp-content/plugins as this will be overwritten by the next updates. I do not want to change WP_PLUGIN_DIR or WP_PLUGIN_URL, because other plugins and plugin components rely …
This plugin works on my live wordpress instance. However, on my local machine, none of the javascript is getting triggered. I think it has to do with plugins_url and it most likely not returning the correct path. How can I fix this? wp_register_script('consultant_scheduler', plugins_url('/js/scripts.js', __FILE__), array( 'jquery' )); wp_enqueue_script('consultant_scheduler'); } add_action('admin_enqueue_scripts', 'consultant_scheduler_scripts'); add_action('wp_enqueue_scripts', 'consultant_scheduler_scripts');
Is there a way to get path to the root plugin folder as a remote URL instead of a local path. For Example: Instead of: c:\xampp\htdocs\wordpress\wp-content\plugins\my_plugin\ I want to get: localhost/wordpress/wp-content/plugins/my_plugin/ Is there a way to get the 'web' path instead of local one?
I'm new with wordpress and I would like to understand better if it's possible to create pages with an url based on the category and then the post title, so: something like http://mysite.com/category-name/the-post-title or http://mysite.com/category-name/12345 (the post id) or http://mysite.com/category-name/12345/the-post-title does exist some plug-in do this or should I consider other ways like url_rewrite to do this?
In my projects I have some components which I use in a lot of custom Plugins as well as in some custom coded Themes like e.g. admin image or video selectors. Those I am holding in custom git repositories. However as those components are used in both - themes and plugins - I always have to manually change the URL getters after pulling from GIT. If the components exist multiple times its not a problem I have wrapped those with …
I have four different Wordpress multisite installs which I would like to keep separate for good reasons, but I would be happy if I could share at least some of wp-content. Is there a clean way to get this done? I tried putting these in wp-config.php: define('WP_CONTENT_DIR', '/home/shared_root/public_html/wp-content'); define('WP_CONTENT_URL','http://www.shared_domain.com/wp-content'); I quickly learned that sharing the uploads folder over various multisite installs will create quite a mess, so I added this: define('UPLOADS', 'wp-content/uploads' ); Sharing plugins folders seems risky as well, …
I would like to change my blog platform from blogger to wordpress. My website is: http://www.hdpeak.net I would like to keep a similar template and all the posts. What are the necessary steps I need to take? Please be specific since I do not want to lose any content of my site. Thank you very much!
So i'm adding a script into my site via functions.php that lives in the plugins directory. The code is pretty straightforward: function add_jq_script() { wp_register_script('r_footer', plugins_url('/responsiveFooter.js', __FILE__), array('jquery'),'1.1', true); wp_enqueue_script('r_footer'); } add_action( 'wp_enqueue_scripts', 'add_jq_script', 999 ); the plugins seem to be working on local site, but in dev console, i'm getting a 404 that seems to be concatting my site-url and the absolute url for my plugins: http://localhost/~thisuser/wordpress/wp-content/plugins/Users/thisuser/Sites/wordpress/wp-content/themes/liberty/responsiveFooter.js?ver=1.1 i'm a bit new to wordpress, the url should be http://localhost/~thisuser/wordpress/wp-content/plugins/responsiveFooter.js is …
For one of my many sites, plugins/plugin-name is a sym link pointing to universal-install/wp-content/plugins/plugin-name. echo WP_PLUGIN_URL displays what I expect. echo plugins_url(); displays what I expect. echo plugins_url('',__FILE__) displays what I expect followed immediately by the absolute path to the universal plugins directory. Is there any way I can fix echo plugins_url('',__FILE__) to return only the expected result?
We have an install of WordPress Network (Multisite) that has multiple blogs running under the url blogs.exampleurl.com where each subsite is blogs.exampleurl.com/site1 /site2 etc... We have a user that already has a URL (www.exampleurl.com/usersite/) and would like to keep his URL but also use our install of WordPress. Can this be done with any settings in WordPress, any plugins, or something else on the server? For clarification, he doesn't want his URL to just redirect to the blogs. URL but …
I have a custom post type in my plugin "Luckydraw" as 'voucher'. By clicking on post link, wordpress generates its URL as : http://localhost:81/luckydraw/index.php/voucher/testing-2/ But I want to change it to: http://localhost:81/luckydraw/voucher/testing-2/ How would I do this?
My plugin is Mailer.app for WordPress, I'm 85% completed and I'm focusing on security before release. Before the questions, I should outline the plugins architecture: The plugin is able to take in username & password and relative imap/smtp server details. The details are validated and made sure that correct imap/smtp are entered (valid connection(s) made) The server details + email are encrypted using the EKEY stored in the class.client.php as CONST The password is encrypted (cannot be hashed as need …
I would like to get relative path from a php file without knowing the absolute path. I have succeeded to do it but for a reason which I don't know, on some servers (in rare case) it doesn't work when I enqueue css/js. Slashes are missing... Here the code: define('PATH', trailingslashit(str_replace('\\', '/', dirname(__FILE__)))); define('URI', site_url(str_replace(trailingslashit(str_replace('\\', '/',ABSPATH)), '', PATH))) What did I miss? Does it come from the server or the code itself?
I created a plugin that is basically a crud to write to the mysql database. I want to know how to display the data on a wordpress page. I'm reading about url rewrites but it seems rewrites are for regular post and just changing the url. I can't seem to find any tutorials on this. so when I go example.com/gallery/1/5 it will take me to the gallery with id: 1 and show me the 5th image.