Is it possible to have the following structure, and if so, how:
www.example.com/something (A custom archive page with posts from a certain post category ['poca'] and a certain custom post type ['cuty'])
www.example.com/something/beautiful (A post of category ['poca'])
www.example.com/something/ugly (A post of my custom post type ['cuty'])
I can achieve to get my custom archive page to work. Moreover everything works so that 'poca' and 'cuty' takes the same template. But coming from something to one of these posts, it takes the normal permalink (category-name or custom-post-type) instead of something
Is there a way to achieve that it takes my custom archive page into the url instead?
By the way: I am able to achieve the result by using a custom shortcode for my custom post type and then creating a new post with that shortcode in the wanted category, but this brings a consistency problem, as there's always the need to create two posts for the one thing I'd like to have.
So I finally found a solution. Seems not the best way but it's ok for me to do it this way...
Through using the plugin "Custom Permalinks" I can add the permalink I want, so I only need to add something for all my new posts in that category and all new posts of my custom post type. But I am still searching for a solution which does that part automatically if somebody knows...
Related
I'm trying to create a glossary for my WordPress site, using a custom post type 'glossary'.
My idea is to create posts for each term/word I want to explain (for example: 'blepharoplasty'), and use the content of the post to provide a description.
This works fine standalone with single post pages, and an archive to display all of them.
But I want to hook this into the rest of my site and automatically find any instances of my custom post titles in post meta data and the_content, and if found, to provide a link to the single post page.
I know a filter/hook is needed, but I have no idea how to write the conditions.
I think 121679 is somewhere along the lines, but I just don't know how to reference my custom post type, and how to search against the current post I'm using.
Can anyone help?
function bv_glossary_content_links($null, $object_id, $meta_key, $single ) {
// What conditions can go here?
}
add_filter('get_post_metadata', 'bv_glossary_content_links', 10, 4);
In Dashboard->Settings, I have Custom Structure for my Posts set to myurl.com/blog/%postname%/
This currently works as intended for all individual Posts, but for Posts with a specific category (in this case, "testimonials"), I would like to change it to be: myurl.com/testimonials/the-post-slug
I tried using this plugin: https://wordpress.org/plugins/custom-permalinks/, and while this works great for setting a custom URL for the top-level Category page, it seems like I would still need to manually set each the custom URL structure for each individual Post, which is not ideal.
I'd like to accomplish this without needing to register a new Post type, as there are currently a lot of Posts in the "testimonials" category and I do not want to need to worry about new loop templates or anything like that.
I would like to know how I can display single posts for a specific page.
ex. page url
http://www.yourblog.com/services/single-service-post-title
I tried creating "single-service.php" but it redirects me to my static front page.
I have setup a page-services.php and that one works fine, but that page is designed to only show a summary of posts.
It's not entirely clear what you're looking for, since pages can't have single posts. They're two different things.
If you're looking for a way to create a template for a single custom post type, you can view an interactive version of the hierarchy here.
You have to name the file based on the id of the custom post type. So if the id of the post type is 'service', then 'single-service.php' would display the single post where post type equals service.
You can also place logic into your 'single.php' to say something like
if(get_post_type(get_the_ID()) == 'service'){
// DO SERVICE-SPECIFIC STUFF HERE
}
This is usually for single custom post types that don't have their own template, but it can also be used as a fallback if that's something you're worried about.
Then you can use an else for regular post stuff and put stuff common to both outside of the if/else.
I want to create a custom post type in Wordpress for a course section on a site. I want to be able to add a course and then within that course add lessons. I know how to create basic custom posts but haven't been able to figure out a post within a post. Is this even possible?
The url structure would look something like this:
www.mysite.com/courses/awesome-course/lesson-1/
This is the sort of thing I'm looking for but want to build it myself: http://www.woothemes.com/products/sensei/
Any suggestions would be greatly appreciated,
Thanks
Install the Custom post types plugin by iLocalize http://wordpress.org/plugins/types/. They have a lot of tutorials on how to add the custom posts to a page. This tutorial http://youtu.be/1SXyHbgjYaI here is the best I've found but there are more the wp-types website.
I have a custom posttype in Wordpress 3. I would like to every post of this type to have the option to add a link. Basicly this will be a link that refers to another page/post whatever on the site.
There should be only one link for each post of this type. And i would then need to extract this link in my template files. Basicly im creating a post-type "Slideshow" And each slide-item should be connected to one page or post. So when you click a slide you will be taken to the defined page.
i know i can do this by using a custom-field. But then i would need to enter the whole url every time. I would like a feature similar to that of the wordpress WYSIWYG editor link button. So i can add a link to "existing content" easy.
Anyone know of any tutorials or similar on how to do this?
Thanks!
bit surprised no one has mentioned this plugin "Related Links"
Wordpress plugin Related Links
It adds a metabox to your edit forms. You can link to related content or put in external URL.
It allows links to posts, pages, media AND Custom post type - check its type on the Settings page of the plugin after install. It uses a similar search/browse facility to the normal WYSIWYG link insert feature!
What post-types does it apply to? If you are using on a custom post type, then check all the post-types you want to be able to link to - it still shows the box on this post-type itself.
It can accept multiple links, but one will work of course. Then you use the get_related_link() function in your template to output this and format as you like.
If you just want to make a link between the two posts, rather than insert it in your post content, I'd recommend the Posts 2 Posts plugin. It'll allow you to create links between posts without having to remember the full URL.
Edit:
I haven't used it, but I suspect the cardinality argument should help you limit the number of links - see the wiki.
And you can certainly access the connections in your templates - I have. Once you've registered your connection type, you can just call get_connected:
$venue_details = p2p_type( 'exhibition_to_venues' )->get_connected( $post->ID, array(
'posts_per_page' => -1,
'connected_orderby' => 'order',
'connected_order' => 'ASC' )
);
It seems to me that the best method to accomplish this would be to add a custom meta box to all posts and post types (see here:http://themefoundation.com/wordpress-meta-boxes-guide/). Within this meta box, you can simply query all posts that you would like to include in a dropdown. You can then select the post from that dropdown, obtain the ID of the post selected (use as data attribute in the option field), and then return the permalink for that ID. This will then allow you to simply select the post, rather than having to know the actual URL each time.
Another method would be to attach a piece of unique data to x post (most likely utilizing custom fields), and then also attach it to y post. In this way, you could use a function to automatically append the link to the displayed post. You would do this by querying the posts in the database, match the custom data, and if matched, display the link to that post. This would allow the entire thing to be automated, and you wouldn't even have to select anything. In my opinion, the title field should actually be sufficient for this, since both posts are different post types (you should be able to title them the same), and would likely make your query a bit easier/shorter since you would simply need to find the post that matches the title, and then link to the permalink.
I can elaborate on all of the above further, with code samples as well, but in my opinion, the question is slightly too vague to write a custom script example for this scenario.
I would hope the above would be sufficient to get you going.