WordPress: How to link post to particular page? - wordpress

I'm new in WordPress and trying to do the following:
I have main menu with some options (Home, File, Edit, View...). I also want to have posts. The posts can belong to different categories that match the menu options. The only last post should be displayed on Home page (Home menu option). Other older posts should be on pages under appropriate menu options.
I've searched the internet but not found the right solution.
Can I do that with WordPress?
I don't know PHP.

I don't get your question properly. As you said you don't know PHP so it will be little difficult but you can make it by custom template or editing your index page of template.
Or if you want to show 1 post(last) at your website without any php, you can go to your Dashboard->Setting->Reading and make "Blog pages show at most" from 10 to 1. But the problem is your website will show like blog. If you are using "Twenty Twelve" let me know i will make it for you.

Related

Cannot create Elementor Posts page in Wordpress although I have selected in Reading page

I want to use my Posts page with Elementor modules.
I have done my Homepage like that
but cannot do the same with Posts page.
I have created an empty page,
added some modules.
And selected this page as Posts page in Reading page.
But when I click a page on my website,
my Elementor Posts page is not seen,
the default Wordpress page is seen.
Update :
I'm using Neve theme on Wordpress v5.8
My website address is Tubefavorites.com
My homepage with Elementor and posts page with default Wordpress has different fonts
and my homepage and posts page's components are in different order.
(In homepage its Tags, Categories, ...
In my posts page its Tags, Last Posts, ...
I'm working online in browser (its not local).
There is no error on Chrome Console.
Update end.
Currently I'm trying this in Turkish pages.
I will make the English Elementor page after I fix this.
How can I fix this?
Thanks
Do you have Elementor enabled for post?
Thus, if I understood correctly, you have created a page post and want to add it as homepage. You should go to settings - reading and select via dropdown the page you have created! Then, you will see your page as homepage and not the default one
There is also an explanation in support forum, that someone has the same problem. Please read below:
"Looks like you’re trying to edit your Posts page that has been assigned in your WordPress Reading settings (Settings > Reading). If this is the case, you may not be able to edit the assigned Posts page directly with Elementor (Basic version).
You can try deselecting the page (in the “Posts Page” box within your Reading settings) then try editing this page with Elementor"
link to the source: https://wordpress.org/support/topic/cannot-load-posts-page-with-elementor/
Thus, disable your page through Settings - Reading, edit/modify (whatever you want) your Post page. After that, you could add your page blog posts URL to the meny item (or use this URL to wherever is nessecary)
EDITED
What plugin are you using for the translations?
I saw your homepage playing correct, right? Thus, you have selected your custom page correctly, through the Settings - Reading.
Now, if you want to see the same results in Turkish, you need to translate your home page too! So, add the translation in turkish language too, or duplicate the english version for turkish one and it will play!
UPDATED
I think there is an issue with the blog page (and single post template, as I am reading in WP forum for this theme). Try to check inside Appearence -> Customize, if there is any options there, thus could change the blog template. Somehow the theme overwrites your options. Furthermore, take a look at the blog theme's doc here:
https://docs.themeisle.com/article/1306-neve-blog-archive-options
I have learned that, I have to use Templates page, in Elementor Pro.
I didn't have been selected it.
Thanks to Hakkı Uçar for this
and for installing and for helping.

Add php variable into Wordpress custom menu

I've been trying to figure out how to add a php variable into my WP navigation links.
Let me explain:
I'm gonna set a cookie on the very first page of my website, when the user clicks on one of 4 types of profile:
-family
-pro
-seniors
-cadres
Currently, I have a theme switcher extension wich modifies the WP theme depending on those prefixes:
http://mywebsite.com/family
http://mywebsite.com/pro
http://mywebsite.com/seniors
http://mywebsite.com/cadres
... etc
The colors & content of the 4 "home" pages are different, but I'm using the WP navigation menu (wich remains the same on every page, so the prefixes disappear when clicking on its links).
Initially, I wanted to modify my menu links like that:
https://mywebsite.com<?php if (isset($_COOKIE['profil'])){echo '/'.$_COOKIE['profil'];} else{} ?>/navigation-link1
Here:
menu
But I can't add php here, and the solution is not ideal because it would only apply to the menu, and not the posts permalinks (I want some posts to be available regardless the profile and I don't want to duplicate all my posts).
Ideally, I would like to have a solution to set the WP theme directly based on the stored cookie. This way, it would also apply when the users click on a post permalink.
I've read things about a "walker" but I don't know what it is, wp_nav_menu_objects, but I didn't understand what files to modify nor wich code to use.
I always search the web to find my answers, but I'm french and I think my understanding has reach it's limits, so if somebody could take the time to explain to me like I'm 4 years old :), I would be grateful.
Thanks

Put categories on PAGE url wordpress

Ok, here is the thing I have already added the categories to the pages (with the help of a plug-in, it's called Add category to pages) and so now I want to change the URL to display the categories (that is to say I want my pages to have this estructure: mysite.com/%categories%/%page_name% right now it has his structure: mysite.com/%page_name%), I have tried to google it but I can't find a straight answer. So if anyone has some resources (tutorials, articles) or some idea (if it's not to much to ask with code examples) on how to achieve this it would be fantastic. (And believe me, I'm asking as my last resource)
you can do it easily with "Page Parent" option available in WordPress.
Steps To create a subpage
Go to Administration > Pages > Add New screen.
In the right menu, click the “Page Parent/No Parent” drop-down/page attribute widget. The drop-down menu contains a list of all the Pages already created for your website.
Select the appropriate parent page from the drop-down menu to make the current Page a child Page.
Add content to the subpage.
Click Publish when ready.
Output - https://example.com/asia/india/
More Info. - Wordpress Subpage Permalink
well you can do this for categories and products from permalink setting, but if you want to manipulate the page url according to yourself then you need to create an blank page with the prescribed name whichever you want to insert, i.e, if you want to insert amazon within the url then create an url with name of amazon, and put the other url's under this parent page.
This way your url will look like
http://example.com/amazon/page_name
Unable to post as comment so directly posting it in an answer, in WordPress you can have custom URL. After you logged I'm as admin under dashboard you have general settings where you can put custom URL's like http://example.com/%caregory%/page_name
For more reference also checkhttp://codex.wordpress.org/Changing_The_Site_URL
I don't know if you tried this but after you login as admin, under Dashboard>>Settings>>Permalinks>>Custom Structure.
Let me know if you have already tried that.

How to make category templates, pages and index appear in the same menu in wordpress?

I am having some problems structuring a Wordpress Website.
Basically this website will have the following pages:
Home
Portfolio
News
Contact
The home will be designed by the index.php, that is no problem. In this page I will show some of the posts that should be in the News and some that should appear in Portfolio.
The pages Portfolio and News should present a list of posts that match this category.
Contact is a normal static page.
My idea was to create a static page for portfolio and for news and to change its theme so I get a list of posts matching this category and handle it. But I found out that this does not work as I thought because pages are not meant to this. For this reason some functions (as the_content) do not work. So I found about Category Templates, which seem exactly what I want.
But now my problem is: my menu is being built automatically and I find it nice. Using the category page template would cause me to need to build it manually, which looks like (for a newbie) a bad smell, once it can be built automatically.
Is the approach with Home->index.php, news and portfolio -> category template and contact -> static page a nice approach?
How would I build the menu in a elegant way with this approach?
Thanks!
Oscar
I don't think your approach was the best, I would have used page templates to pull the different layout/type of pages and use the front-page.php to create the homepage.
But every dev has his own way, I guess.
I think you can easily solve your problem building the menu with the built-in menu builder of wordpress. You can go in Appearance > Menu if your theme is compatible with that.
Check further documentation here
hope it helps!
cheers
In wordpress you can add static page or categories or any other pages to wordpress menu. For creating menu in wordpress see this links.
creating menu

Wordpress News website, multiple layout, category base?

I have a theme, I am html web designer, but I can understand some php / wordpress coding also
I have a wordpress theme & I want to convert it into a news portal
Please guide me, I want to convert it into category base, should be like that
http://www.firstpost.com/ please guide me, how can I do ?
is it archive page or separate category page?
--
http://www.firstpost.com/category/world
when browsing category page, you can see there are different post layouts
without any duplicate post
please guide me
You can simply make a main menu containing links to your categories. This will load in the page you set as post-page (ie. the page that contains your posts).
Go to Appearance - Menu. Create a menu and set it as the main menu.
instead of ticking the boxes for linking to pages, create menu links like www.domain.com/category/cats and www.domain.com/category/dogs
http://codex.wordpress.org/Function_Reference/wp_nav_menu

Resources