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

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.

Related

How to create another html page in visual studio code?

I need to create another page for my website, because I AM DONE with my homepage, i am newer to coding, so please explain it very thouroghly and remember IM USING VISUAL STUDIO CODE thankyou anyone!
Simply add a new file at the top left corner. then give it a name of you liking and an extension that you usign like .html
Then you write that new page like you wrote the first page and add links beween both sites with the link tag.
I would say save your index.html as about.html. This way all you need to do then is edit the content. The CSS file and all other items will still be linked.
FILE > SAVE AS > about.html
Edit the content for the about page and repeat the steps for each page.
In your index.html file you can link to your about.html file like this
<a href="about.html>ABOUT US</a>
This will be the quickest way. Then you wont have to start from scratch with every page.

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

Homepage link to dashboard in Wordpress

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.

How to add a HTML Home page to a prestashop page

I've developed a custom HTML homepage for my prestashop site, but it seems I do not know how to incorporate it, I've tried looking into the prestashop forums, but all it shows are for .tpl files, is there a way for me to link them to the homepage?
Can I just link it as an html page or do I really need to put it inside a tpl page for it to work?
Create your .html file (say 'test.html).
In test file you need to
add these lines of code before your html code
<?php
include(dirname(__FILE__).'/config/config.inc.php');
Tools::displayFileAsDeprecated();
include(dirname(__FILE__).'/header.php');?>
Also add these lines after your html code
<?php include(dirname(__FILE__).'/footer.php');?>
Place the test.html file in the public_html folder.
Now you need to add the page to link with your site.
If it is home page you need to add it to index.php otherwise you can just add the url (http://mysite/test.html) to menu bar or footer links, where ever you want to put it.
I have placed my php page link in the footer information part using anchor tag as shown in the image
In prestashop you can find "Home Editorial" module, in this module you can put your html obviously the module need to be transplant in displayHome position.

Linking from a subfolder back to the root folder index.html file

I am having trouble linking from a subfolder index file back to my root folder index file.
I have a logo in the nav bar of example.com/blog that I would like to have link back to example.com
I have tested various linking options for the logo image including
<a href="../index.html">
<a href="http://www.example.com">
<a href="../">
And none of them seem to work. The logo image continues to link to example.com/blog/index.html
The strange thing is that if I right click on the image and then select open in a new window/tab, then it will load example.com just fine.
I am at a complete loss.
Could this be something related to my .htaccess file?
Additional Info
I added a "Home" text link to the nav bar using the below syntax and it works perfectly.
Home
The image for some reason will not link back to the rootfolder index.html file using the same syntax. It keeps loading http://www.example.com/blog/index.html
Try using a javascript redirect
function home() {
window.location.replace("http://example.com");
}
<button onclick="home()">hi</button>
Replace http://example.com with your website.