Path for contact form file

I have a php contact form that I use with all websites, so ideally I want to avoid using a plug in. The files used include: • contact.php - A file with php/html write up which displays the form fields. • contact-form.php - A file that contact.php connects to to send the information. I've created the equivalent of contact.php as a static page in the Wordpress login. The code within contact.php which connect to contact-form.php is as follows: <form method="post" …
Category: Web

ABSPATH not working! Any idea why?

This is what in my wp-config.php : if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); I am calling from plugin/pluginName directory to : require_once( ABSPATH . 'wp-includes/user.php'); But it is returning: Warning: require_once(ABSPATHwp-includes/user.php) [function.require-once]: failed to open stream: No such file or directory in /home/------/wp-content/plugins/---/---.php on line 43 Fatal error: require_once() [function.require]: Failed opening required 'ABSPATHwp-includes/user.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/------/wp-content/plugins/---/---.php on line 43 Any idea why I am having this error? Any solution? Thanks.
Category: Web

How to add tags under categories

How to add specific tags under categories on Wordpress Main categories on my blog example.com/recipes example.com/fashion example.com/beauty example.com/life I want to add tags under this recipes category like example.com/recipes/tag/appetizers example.com/recipes/tag/breakfast example.com/recipes/tag/dinner these tags should not be accessed via other categories like example.com/fashion/tag/appetizers example.com/beauty/tag/breakfast example.com/life/tag/dinner i need to generate archive pages for different tags specific to that category like Appetizers Archive - example.com/recipes/tag/appetizers Breakfast Archive - example.com/recipes/tag/breakfast Dinner Archive - example.com/recipes/tag/dinner is this possible? thanks.
Category: Web

How can I get a link path to use for my resources such as JS scripts?

Is there a function that would return the equivalent of plugin_dir_path but it being agnostic of a plugin / theme? JS scripts need to be enqueued as resources, as such, you cannot include their on-server path which is, say /var/www/html/wordpress/thing/thing2/script.js, it needs to be the http://www.example.com/thing/thing2/script.js counterpart.
Category: Web

Img src path from wp-admin

Hi guys I have a quick question: My path which I used for images in the php-files locally was something like this: src="<?php echo THEME_IMG_PATH; ?>/icons/cv_icon.png" But from the wp-admin this doesnt work and I do have to for example: src="wp-content/themes/mytheme/images/icons/about_icon.png" First, why is that? Because i defined the THEME_IMG_PATH in function.php? But then why dont for example <?php echo get_template_directory_uri(); ?>/images/image.jpg or <?php echo get_stylesheet_directory_uri(); ?>/images/image.jpg work? And, is the wp-content/... way the right way to do it, or …
Category: Web

How to get path or root of plugin folder, not file or dir?

I want to include one file from the plugin root to somewhere in the plugin folder. Folder structure: /plugin /folder <- Can't 'esacpe' from this folder to root /otherfolder /req-file-to-here.php // fetch here /req-file-from-here.php // send from here What to exactly type in file req-file-to-here.php ? I have tryed something like this: require plugin_dir_path( __FILE__ ) . '..path to file'; or require plugin_dir_path( __DIR__ ) . '..path to file'; Not working. Help :)
Category: Web

How to display a raw HTML page (bypassing WordPress theme, scripts, etc)

I'm a software engineer with a WordPress site with hundreds of pages, and it's working very well. There are certain cases, however, where I'd love to be able to code my own page with no interaction with / interference from the WordPress system (no themes, no styles, no javascript, etc) yet still have it located on that same subdomain. How can I set https://example.com/special-page to display an HTML file uploaded somewhere within /wp-content/? And as a bonus, I'd love if …
Category: Web

Multisite problem with unexisting paths to CSS etc

I have the multisite Wordpress site: domain.com/siteA domain.com/siteB Now when the post is published on main site (domain.com), it looks fine because bunch of resources are OK path: https://domain.com/wp-includes/css/dashicons.css?ver=5.7.2 and that URL actually exist. However, all my subsites create automatically resources links like this: https://domain.com/siteA/wp-includes/css/dashicons.css?ver=5.7.2 https://domain.com/siteB/wp-includes/css/dashicons.css?ver=5.7.2 Notice it cosiders domain.com/siteA to be the root, and just concate the rest... And everything on the page is rendered like that! And that URL and bunch of other URLs doesn't exist, so my …
Category: Web

Pulling images from a subdomain

I have created a sub-domain img.domain.com and in the database I have changed the required paths inserting the root and the url to this sub-domain. I have also changed these paths in options.php under admin setup. All my media is uploading nicely to the new subdomain, with the year and all; folders being automatically created. In media library the image shows the link to the collect location of the image, but the image in the media library is just a …
Category: Web

Add custom path to url to specific pages

Right now all pages path like /faq/ or /about/. I need path like /home/faq/ /home/about. I tried change url slug in edit page. But Wordpress change my home/faq to home-faq. I installed plugin Create And Assign Categories For Pages And add custom categories, but paths don't changed. How can I do this task?
Category: Web

specifying relative file paths in WP with jQuery requests not working

Why does it seem that WP requires me to utilize the entire and true file path instead of being able to use a relative file path? I know for safety its better not to use a true file path. In one of my functions, I am specifying a .php file located. Seems no matter what I do, I can not get my function to point to find the file. The full directory that the php file is in domain_name/public_html/wp-content/mythemename/assets/php/select-change.php A …
Category: Web

Plugin base URL

In a question that is related to, but not the same as, How to link to images in my plugin regardless of the plugin folder's name plugin-folder/plugin-main-file.php plugin-folder/images/ containing all images plugin-folder/classes/ containing class definitions plugin-folder/classes/class1-files containing additional files for class 1 plugin-folder/classes/class2-files containing additional files for class 2 etc To access images, I can use relative addressing, such as plugins_url( '../images/image.png', dirname( __FILE__ ) ) but this requires a knowledge of the file structure, and a level of hard-coding …
Category: Web

How do I 'rebuild' the WordPress Media library after transfer to new host?

I recently inherited a large site from a developer that vanished. The site has more than 6,000 images. In the pages most of the images are missing, however, they are referenced in the media library and I can see them on the server under wp-content/uploads. When I try to access any of these images with the blank thumbnail I get the following error message: Missing Attachment Given that this site has been moved to a new host I am pretty …
Category: Web

How much control do we have over CPT rewrite slugs? Can I create a "root" page for my CPT with out the page path, and then have paths for other pages?

Say I have a CPT called I dunno, "Library" which is just a set of "pages" ("has_archive" => false) and the rewrite slug is "library". I also intend to have a set of pages like "about", "archive", and "new books". Can I do something so that I make a page called "home" and instead of its url being https://example.org/library/home could it be https://example.org/library? And then the about page would have the url of https://example.com/library/about NOTE - I know that I …
Category: Web

Error in the paths of one of the plugins when changing the plugin directory

I decided to change the standard path to the plugins folder. Now all my plugins are located in site.com/modules In wp-config I have the following written: define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/modules' ); define( 'WP_PLUGIN_URL', 'https://example.com/modules' ); define( 'PLUGINDIR', dirname(__FILE__) . '/modules' ); In the end, everything works, but plugin JetEngine in the console gives 404 errors on cx-vue-ui.js and vue.min.js. The fact is that the new path to the folder with plugins is duplicated for some reason and looks like …
Category: Web

How to route root path / to /xyz in nginx?

I am using PHP based application in which i need to configure Nginx. I wanted to forward only path / to /?product_cat=top and all other request will remains same. below is my Nginx configuration: server { server_name default_server; listen 80; root /var/www/wordpress; underscores_in_headers on; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH'; add_header Allow "GET, POST, HEAD, OPTIONS, PATCH" always; access_log /var/log/nginx/ecom.log json; error_log /var/log/nginx/ecom-error.log; index index.php index.html index.htm ; location = / { return 301 /?product_cat=top; } location ~ \.php$ …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.