wordpress post link to category [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have been searching for a result on google, but I haven't succeeded yet :( .
I'm trying to change the destination of a post link within wordpress.
I have a link to a category page, this category gets (at the moment, but not limited to...) 3 posts.
What I would like is that those posts each link to another category when clicked. But i dont want the links to be hard coded, so i could change to what category they link at any time.
Is there a way to make this work? Or is there a (fairly simple) alternative way of doing this?

Your posts act like categories. So why should a link to a post redirect to a category page (this question is rethorical - semantically it just shouldn't)?
You should try to define your system via categories and subcategories. Wordpress offers huge functionalities for this system and there are plugins out there if you want to extend your categories with additional post-like content (thumbnails, formatted descriptions, etc.).
If you need user interaction you can easily build a form with ACF, NinjaForms / GravityForms where other people can add such category items.
I really don't want to be rude - but having posts that actually link to categories instead of behaving like posts sounds just wrong.

Related

I want to use category as custom type in Wordpress theme [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Generally, in WordPress when we click on any category, a page opens with all posts, associated with the category. I want to make a tweak in this behavior. I want when a category is clicked, all child-category should be listed and when a child-category gets clicked, all associated posts should be listed on the page.
I have no idea how to achieve this.
Could you guys give me any idea?
Regards!
If you would like to always show the categories, regardless of if they have posts, you could move the echoing of the '$category->name 'outside of the if '($posts)'. The way that it is currently, the category name will only be displayed if there is a post with that category.
I think that a potential bigger challenge would be to display the categories in a hierarchy (indenting the sub-categories). If you simply move the display of the category name above the check for posts, they will all show as top-level categories. Here is a discussion of someone working on this issue on Stack Exchange:
https://wordpress.stackexchange.com/questions/270176/showing-categories-and-subcategories-with-posts
I wonder if another possibility would be to use: https://developer.wordpress.org/reference/functions/wp_list_categories/ and then override the HTML generation. It looks like that is what is happening here:
https://wordpress.stackexchange.com/questions/98755/how-can-i-customize-the-wp-list-categories

Is it possible to implement this design for woocommerce? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have this design that I want to implement: it has this button to show recommended bases for that specific product. When I google about customizing woocommerce, all I get are tutorials on how add stuff around it, using newbie friendly tools, such as elementor, but I want to work in it, adding a feature to it.
For my layman eyes, it seems like a very simple interaction: you click on a button, and it adds some elements to the page. However, since woocommerce's cart is implemented on the page through a shortcode, not an html file or whatever, I can't just edit it like I do with most stuff. I know that I have to edit some php file somewhere in the plugin's directory.
So, what I would like to know is first: is that even possible? Because I really don't want to spends days learning to code php just to find out this feature was never even a possibility to begin with.
And second: is there anything in particular I should learn to be able to do this?
Sorry if this doesn't make sense, and thank you for the attention. :)
You can do this. You would have to build a new 'template part' to replace the cart template that outputs what you're seeing in the video you posted.
A full list of all of the template parts for the WooCommerce cart view is here:
https://github.com/woocommerce/woocommerce/tree/3.8.0/templates
There's a really straightforward breakdown of how to override default WooCommerce templates here:
https://docs.woocommerce.com/document/template-structure/
The shortcode that goes into the page utilizes these template parts to generate the content you end up seeing on the front end.
I think the file you'd be looking to override is this one, but still, take a look at all of them and confirm that's the case:
https://github.com/woocommerce/woocommerce/blob/3.8.0/templates/cart/cart-item-data.php
I suspect you could use the WooCommerce related products and upsell functionality to populate the list.

PHP CMS - How to 'Creating New Page' works [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to learn, how to make a php content management system. I'm watching tutorials and reading documents about that but I couldn't understand something. For example there is 5 different page design.
Home Design
About Us Design
Products Design
Gallery Design
Contact Design
When I click new page button what should happen backside. Should it create a new php file or just insert a new line to the database. And for example when I want to create products pages at 3 different category. Should I need 3 products.php file or just one file for products design. And when I want to add a page should I design 5 different admin interface for each page? Actually I am not asking for code. I just want to learn the best way to do these things.
Thanks all :)
You should make a table in your database, call it "pages" and add columns:
id
title
content
published_date
status
and any other.
Then pass the page id via url (?p=123) and use query to show the relevant page via database.

Multiple HTML pages & Pagination [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Okay, so currently I'm creating a website from scratch for my small online shop and am stuck on where to even begin when it comes to my Products page. Currently, I have 1 page that displays all 50 of my products. I plan on expanding my products and do not want someone to be scrolling down the whole page. I would like to add multiple pages that you can click through and I believe I can accomplish this through Pagination. Now, this is the part where I get confused : say I only want 25 products to be displayed per page and I add a new item to the first page - how do items get 'bumped' to the page 2, 3 etc.? I would imagine there is some function to accomplish this, but the only way I can think of is doing this the brute force way of manually moving a product out of one page and onto another. Any suggestions??
Currently, my website is coded in all HTML / CSS and I currently just learned how to use PHP to mass edit certain areas of the website -- I am in the learning stages! Any suggestions would help. Thanks!
You need the help of a database to paginate your products in sets.
Basically, the database will have a "Products" table, each row in the table will represent a single product. You will use PHP to ask the database to retrieve the first/next N rows and then write out the appropriate HTML around each returned row to create a list of products.
There are lots of tutorials on the web to help you learn while you practice. Good luck!
There is no way to do that on static HTML web-site.
You need server-side script (e.g. PHP script) for splitting your product list by pages. By the way, you should store your data in DB and it should be done on the DB-side to not overhead your PHP side.

Wordpress specific post when page loads [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am creating a Faculty Page in WordPress, and I am trying to figure out how to have a specific post load content when the 'Faculty Page' is clicked. After that the user has a choice to click on any faculty member which will change the content that was generated when the page was loaded.
The user will see the same content in the area when the page loads, then that content will change based on which faculty member they chose.
I know it isn't much to go on, but any help would be appreciated!
Thanks!
Try this:
http://en.support.wordpress.com/posts/post-visibility/#sticky-posts
"By default, WordPress.com blogs display posts in reverse chronological order on the home page with the latest post at the top. There isn’t a way to display posts in chronological order, but you can mark some posts as Sticky to make them appear above the other posts. They will stay at the top of your posts until you uncheck that option on the Edit screen for that post.
You can mark a post as sticky by checking the option that says “Stick this post to the front page” in the Publish settings on any post."
edit: Also, I think there is a WordPress exchange that might help you better than Stackoverflow.
edit: Yeah, try here, https://wordpress.stackexchange.com/?as=1

Categories