I want to use WP for a site that blog is just one aspect of it, and I don't want requests to home_url list blog posts (post_type=post), I want them be to fetched using another URL.
This topic default-archive-url-wordpress suggest two ways:
page_for_posts option
post_type=post URL query parameter
but I have questions
About the first, How a page would be able to loop into the posts, and where I should update this option (which hook)?
For the second, the guy says that using this param, make the wordpress get the archive for the specified post type, but I think posts don't have archive (according to includes/post.php their has_archive is left to default) how should I change this and also I want to use a permalink/pretty link for accessing posts.
Thanks in advance
Go to settings -> reading, and change the front page displays posts settings to front page displays a static page and then select a blog page.
Easy as pie.
Related
I have been working on a site created by another developer. I have been fixing the site to make it more visually appealing. I am also responsible for adding new events and pictures which i self taught myself to do.
I have a situation where I have a page with the following permalink:
http://www.cic-nj.org/events/
The problem is that this link goes to a page that does not show the edits that i am making under that page and there is no other page listed that shows the info it actually displays.
this is what I have in the editor box on wordpress that I want it to show.
enter image description here
this is what appears when url is used or when i click view
enter image description here
I have been sure to click update and renewing page to view it. it's like its going to a ghost page i can not edit.
Can anyone point me in the right direction on this?
Thanks in advance...
You are experiencing "slug collision": more than one thing in your WP install has the same slug.
The problem that you have is events is a custom post type, with a slug set to events - therefore the url http://www.cic-nj.org/events/ is directing to the listing of events. This is an automatic feature of WordPress. (Note - you can see more details to support this conclusion by the fact that you've got individual events accessible at url's such as http://www.cic-nj.org/events/blue-apron-info-session/ )
Note that custom post type slugs will always take priority over a page / post slug.
You have a couple of options:
If you want a page to display the content that you've created, the page's slug / permalink must be different than events
If it's acceptable, you can rename the slug of the "events" custom post type to something different. This has the potential consequence of losing SEO "juice".
If it's acceptable, you can remove the custom post type, if you aren't going to use them any longer.
NOTE: It may be tempting to ask "how do I remove the custom post type", or "how do I change the post type slug". Those are different questions, and if you need to ask, they should be asked in a different question - not added as a comment below.
This is in a way a followup of this question : Jetpack Publicize: Sharing only on Twitter for a category
I am currently working on a website in which one of the category only serves as a way to curate news on the net and then, share it on the front page and on Twitter.
The post itself is empty, I use a custom field to receive the URL from the user, grab a few things from the target website, update the permalink and save. Upon saving, SNAP publishes the post on Twitter.
My issue is that it is not using the permalink but the url of the post itself (which is absolutely empty). Having a look into the plugin's code, I saw that it was using post metas (most notably urlToUse, snap_MYURL) but couldn't determine if it was a priority issue or something else.
I also try to adjust my code to set these meta values to the url I want, to no avail.
Is there a way I could set my custom functions or the SNAP plugin so that the permalink is used ?
No answer after a week, neither here nor from SNAP's support. No problem.
The ugly patch I used :
Jetpack Publicize for all the Twitter updates
SNAP for the Facebook ones thanks to their ability of posting based on a specific category
It's bloated and I'd love to understand but, sometime, you have to ship
I am using WP Subdomains plugin which is working perfect and I can restrict posts to show where I want by the sub-domain slug. But if I search for word using wordpress default search widget it shows all posts regardless of the sub-domain.
I don't know how can I restrict search to filter posts and show only with respect to the sub-domain and in case of upgrade how can I stop to override my newly created search widget.
Search Everything plugin is having a area where you can exclude categories you want. but I dont know what about subdomains and WP Subdomains. Please to feedback if you managed to use the two plugins at the same time.
To restrict the default search of wordpress you have to edit your the page where the searchform is sending the typed text. Searchform is just sending informations, what you have to check is the destination file.
Check this link : http://codex.wordpress.org/Creating_a_Search_Page
Okay I did it with my custom search page.
I'm working on a latest version of wp.
I need this kind of functionality but not sure how to do it.
I want to post an blog article which will be available on its main category listing page for set period (from published from & to date - to date is the last date until when it will accessible on category page using pagination. But after to date this will not be list in category using pagination. But still stays on given url and accessible by direct url for SEO reason.
Basically I want to make a pagination to be valid for only a post published under certain period.
Both cases are fine, do you know any plugin which can be used or need to customize?
I don't know about a plugin, but you can simply customize your wp_query: http://codex.wordpress.org/Class_Reference/WP_Query#Time_Parameters, and make sure you use the "paged" parameter described here: http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters
Can a post be hidden from home page, archive view, category lists etc. and viewable only if you have a direct link to it? The blog doesn't have registered readers and is open to public so that would be a mean of hiding some posts from public view without using the password protection.
I asked this question in Wordpress section and the idea there was to use conditional code so I'm asking the question here as well to get closer to the code.
If I used conditioning, would I have to input each post's ID separately to PHP file for archive, categories, search and such?
EDIT:
After reading a bit more all over, I had an idea of creating a private category and then use some kind of conditioning so that posts from that category are hidden. According to Codex, certain category can be hidden from, for example front page but I don't know if there's a way to hide it altogether except when you have a direct link.
Creating a "Private" category is a good solution. It is quite possible to hide this category altogether except via direct link. You just have to "block all the exits" with conditional code.
The default WordPress theme displays posts via the Post Loop. See http://codex.wordpress.org/The_Loop, especially the section entitled "Exclude Posts from Some Category". Just find all the places in your theme's PHP files (e.g. index.php) where this loop is used, and add the conditional code. You'd also need to filter your category list and blog archives in the side menu. Don't add filtering in single.php, otherwise the private post won't display on its own page.
You'd probably want to add a similar condition to filter search results so that private posts aren't leaked via the blog's search tool. There may be more "exits" I haven't thought of, but I'll be sure to update as I do. I'm glad to look at specific code if you so desire.
Understanding WordPress' post query and loop really opens up a world of possibilities for customization.
I found the simplest way - just use Simply Exclude Wordpress plugin. It has the option to exclude each post (or tag, for that matter) from front page, archive, search or feed. It works flawlessly. You can still view the posts by using direct links.
(Not actually an answer that includes code but a working solution nonetheless.)