Homepage link to dashboard in Wordpress - html

There is a link to the wordpress dashboard link on the homepage of my wordpress site and when the link is clicked it reloads the page with the url + ?login=failed and does not take me to the dashboard.
When I type the url directly into the url bar adding /wp-admin it loads just fine. It only reloads with ?login=failed when the link is used. Could this a problem with my wordpress configuration or is this something you can't do with wordpress in general?
Additional info:
The blog is on the root of the directory. e.g. http://www.example.com
The links works correctly if the wordpress user is logged in.

What is the full URL of your blog (you can use a false name)?
A forward slash is relative to root, so you might have domain.com/blog, in which case href="/wp-admin" will point to domain.com/wp-admin, instead of domain.com/blog/wp-admin
Your best bet is to use the WordPress admin URL constant in the href in your PHP file like so ...
<a href="<?php echo admin_url(); ?>">
... or use the site URL constant ...
<a href="<?php echo site_url(); ?>/wp-admin">
... both should give the desired result.

Related

How to correctly link page not folder with same name without .html extension

Maybe really dumb question but I'm building my first site
http://iservis.info/
Im trying to build classic URL structure
I have single page "Opravy" where all devices are listed and if you clicked on certain one i want to have URL "http://iservis.info/opravy/iphone-xs-max.
So on server i have a file "opravy.html" for main page and folder "Opravy" with all sub-pages with certain devices.
enter image description here
I also have .htaccess for all .html extensions
But problem is that in nav-bar I have nav-link "Opravy" and my code is like this
<a href="opravy" class="nav-menu-link--block desktop-only w-inline-block">
But its showing error because I think its trying to link the folder and not the "opravy.html" page.
So how do I link the "opravy.html" page to nav-link but without showing .html in URL ?
Thanks a lot
Maybe use directory structure + index.html? Each index.html is rendered at the corresponding url that matches the directory structure. Something like this:
/
index.html
/../opravy
index.html
/../../iphone-xs-max
index.html

Link breaks when visitors use different urls to same page

I am building a website. The files are:
/index.php
/pic.jpg
/dir/index.php
/dir/pic.jpg
people can visit my site's dir/index.php page using different urls:
1. site.com/dir
2. site.com/dir/
3. site.com/dir/index.php
I have a link in /dir/index.php, which I want to relativly link to /dir/pic.jpg :
<a target="_blank" href="pic.jpg">
The problem is: people using url 1 get /pic.jpg , and others using url 2 or 3 get /dir/pic.jpg
How can I write a relative <a> link in /dir/index.php that links to /dir/pic.jpg whatever url visitors use?
I want to make folder dir portable (I may change dir's name, or copy dir folder to another site so it may have different path), so hard code href="/dir/pic.jpg" isn't a good solution.
You can use ../ to go back a directory. Thus, if you're in the dir folder and you want to go out of this folder into its parent directory you can use:
<a target="_blank" href="../pic.jpg">Link</a>
Or you can simply just use your site's URL (however this isn't as robust):
<a target="_blank" href="http://www.example.com/pic.jpg">Link</a>

How to display wordpress login form on index.html home page?

I have an existing HTML website. And then Wordpress installed on a separate folder. Wordpress has login, and content .. How can I display the Wordpress login form on my main index.HTML page ? and so once logged in from home, it would redirect to the Wordpress logged in sections ???
You should be using an index.php instead of an index.html file. That will allow you to use WordPress functions outside of WordPress. That would then allow you to put <?php wp_login_form(); ?> wherever you want the form to go.
Otherwise you'll have to copy the HTML output of the current login form and paste it into the html file.

Local WordPress Setup Won't Change Page Content on New Link

I'm working on a local WordPress setup using MAMP and am unable to get my pages to display new content other than the index.php file.
I currently have two pages: index.php and information.php.
When I click the link in the navigation bar, it redirects me to the information.php page, but the content within that file is not displayed.
I've checked all the usual things (ie. browser cache, permalinks, .htaccess to allow override), but can't seem to make any headway.
Any suggestions would be appreciated! Please let me know if you need to see any additional code as well.
header.php
<a class="dropdown-toggle disabled" data-toggle="dropdown" href="main_hubs/information.php">Information
<span class="caret"></span></a>
information.php and index.php
<?php get_header();?>
**Updated Content Here***
<?php get_footer();?>
Wordpress loads everything on the index.php of your installation and then it uses a routing system.
To be able to use information.php you must add it to your current theme and then add a snippet in the functions.php that makes the relation between a slug of a page to a .php file.
For instance: This code looks for a page that has the slug "information" and if found it will load the information.php file on the theme.
add_filter('page_template', 'my_custom_template');
function my_custom_template($page_template) {
if (is_page('information')) {
$page_template = dirname(__FILE__).'/information.php';
}
return $page_template;
}
This link is also very helpful in how wordpress works with links and slugs:
https://developer.wordpress.org/themes/basics/template-hierarchy/
Go to your wp-admin panel > setting > permalinks choose your links according to your page url which is just below your title of your page. I think this would work if not pls let me know.

Structuring html links

I'm working on my site on localhost. I have my directories as follows:
My index page is located directly in the site folder as such:
../htdocs > mysite > index.php
My our-profile page is located in sub-folder called about us as such:
../htdocs > mysite > about-us > our-profile.php
I have a link on the our-profile.php page that should link back to the homepage like this: <a href=..\index.php>Home</a>.
But i keep getting a 404 - Not Found error. It uses the about-us directory as the root. So the link above tries to search for : http://localhost:8888//mysite/about-us/mysite/index.php
instead of
http://localhost:8888//mysite/index.php
How do i re-structure the links?.
EDIT:
I'm working with dreamweaver. Could it be an issue from dreamweaver?
you're using backslashes, use forward slashes
<a href=../index.php>Home</a>.