Can't visit anchored links in WordPress - php

I'm trying to build my theme for a school project and I'm using wordpress to set up a blog.
I don't have intentions of sharing this theme so all of the website design is already premade.
The problem occurs when I try to enter the blog.php file from my navigation. My homepage is index.php file from which i navigate to the blog site. Everytime I do so the index page refreshes instead of opening the blog.php file, but the browser search bar shows the directory location as blog.php.

Wordpress does not work on a process of just make a file and it can be used as a page. Instead, it uses template structure. Meaning blog.php is not a page, it is a template (if you have setup the file structure correctly). Putting link through a menu to "blog.php", confuses WordPress and it just displays the default page of the site. You should make each page through WP "Pages" section.
StackOverflow hates WordPress questions. WordPress has its own help forum. I suggest googling for it and ask questions there.
If I mistook your question here are some helpful links:
https://developer.wordpress.org/themes/basics/template-hierarchy/
https://codex.wordpress.org/Theme_Development

Related

WordPress a static homepage and custom blog page

I installed Wordpress in "localhost/" directory.
I created a file called home.php and designed it as a landing page.
I want to move my default blog posts to the "localhost/blog/" directory.
But I don't want other links to be affected by this. So "localhost/blog/contact" is wrong behavior.
But every way I tried caused problems like this.
https://wordpress.stackexchange.com/a/238727/183195
https://wordpress.stackexchange.com/a/245136/183195
https://wordpress.stackexchange.com/a/131667/183195
https://stackoverflow.com/a/60605443/12944128
All of these only work as a "single post" way. So "localhost/blog/" does not contain an archive and will not work. Only the "localhost/blog/post-slug/" link works.
Is it that difficult to create a blog with an archive page of its own "slug" in WordPress?
Don't believe you can do it without some serious htaccess manipulations. The permalink structure is set up for either including the 2nd level or not, no in between.

How do I assign default pages of Ultimate User plugin in WordPress?

I am a beginner in WordPress and tried to use the Ultimate User plugin. Installation seemed fine and when I add the default pages to my menu options, and click, it will have a "/?page_id=12" path (or different numbers) but the same page as I see as a home page. I was expecting to see pages such as "members" with a list of members or "profile" with your profile details.
I have tried creating a blank page.php file in my drive but that made the entire page blank, instead of the same contents as the home page.
I have just the add_theme_support('menus'); line in my functions.php file.
There are some .php files in "templates" folder of the plugin but I am not sure if I should copy that file to my "themes" folder, or do anything with it to show the right page.
It would be appreciated if someone could give me some tips to solve this issue. Thank you.

Integrate Wordpress post/blog in my website

I have a site which is the cms of Eccube ( ecommerce) . It doesnt have dynamic post feature like in wordpress and all.
I want to integrate the wordpress inside my website. It can be anywhere like new page or anywhere.
I have also installed wordpress inside eccube directory with folder name BLOG .
So the actual path is like this :-
/public_html/azlily.awe.jp/eccube_1/html/blog
I have created a new post, thats fine but going to that post will open in wordpress templates, It will look like two different websites. I want the post to appear inside my eccube website but not with wordpress website.
Any solution for this. I googled but only found Wordpress and html website hook up but not with eccube.
Only one option is redirect wordpress blog to "www.example.com/blog" or "blog.example.com" on click
You can access wordpress blog from "BLOG" folder directly
You need to change layout of the wordpress blog so that it will match with your main website, So that it wont appear like two different websites

Empty links in Wordpress

I got my own created template in Wordpress. I got two pages : index.php and ab.php. My question is what should be a proper link code that links these two pages in menu? Because I always get 404 page or index.php page or blank. I try'ed everything including saving permalinks.
Here are a few of my examples:
http://example.com/?p=ab
http://example.com/?p=ab.php
<a href ="ab.php">
etc.
My guess is that this is your first WP theme.
If that is the case I should tell that the hierarchy from pure php websites won't work. Check this https://developer.wordpress.org/themes/basics/template-hierarchy/ WP uses the wp-admin part for creating new pages.
If you are switching from php to WP, I think I can help a bit by giving few pointers.
If there is an issue with your project I can't quite get what is happening but if you call http://example.com/ab.php the php inside will run however it's not cool to reference pages that way in WP.

Adding my own static webpage to a wordpress site

If my title wasn't clear, basically what I'm trying to do is to add my own HTML or PHP page to Wordpress, so i can play around with some web dev.
So essentially I just want a test page/pages added to my site. However since I have installed Wordpress on my website, I can't just add "index.html" to my root folder using my FTP client. I wonder if I can/can't do this and if so how to link to the pages I add using FTP.
Sorry if this doesn't make any sense. I just want to add some of the sites I've already made / ones I am creating to my site so I can easily show clients/employers what I can do, and I apologize again if I'm being an idiot.
Create a sub-directory in your root folder and then simply link to it:
www.domain.com/mysubdir/index.php
the other way to do this... create a page template in wordpress
create a php file named: template_mypage.php
You must put this php comment line at the top of your template file:
/* Template Name: My Page */
go to wordpress backend and create a new page
in the "Page Attributes", you can find a drop down list named "Template". In the list, you should be able to find "My Page"... select it and then save your page.
view it!
You can always create a subdomain or create a folder inside public_html/www/ and redirect it from any other domain or from any static link you have on wordpress
Why not use WordPress and put your portfolio together using Custom Post Types? I recently presented on this and there is a handy plugin for Custom Post Types UI that you can create a whole new section of your site and make templates for your portfolio.
Just a thought.
If you do a static page in WordPress, you can still template using the Page system as specified in another comment. Code your page, separate it into header, footer, content, etc files. You can load the file to your root, but not name it index. If you do a subfolder, you need to not have an existing page in WordPress.
HOWEVER, you can still do a "halfway" static page still using WordPress and do a header-staticpage.php, index-staticpage.php, and footer-staticpage.php and make sure to include the code for WordPress header and footer in the new header and footer so you can still reap the benefits of the default jquery that WordPress allows. Don't forget to name your template and when you create the page in WordPress, you can just leave the content area blank if you have hardcoded the page's content in.
I still recommend trying Custom Post Types. It is not hard and there are some great presentations in Slideshare that cover this aside from the plugin I mentioned earlier in this comment.

Categories