Inserting a link to another post in Wordpress - wordpress

I'm putting together a site based on a Wordpress template, and was wondering if there's a way to link one post to another without entering the full URL. I'd like to be able to use something that doesn't change if the parent directory or subdomain changes. Any ideas?

Posts
To link to a Post, find the ID of the target post on the Posts administration panel, and insert it in place of the '123' in this link:
Post Title
Categories
To link to a Category, find the ID of the target Category on the Categories administration panel, and insert it in place of the '7' in this link:
Category Title
Pages
To link to a Page, find the ID of the target Page on the Pages administration panel, and insert it in place of the '42' in this link:
Page title
(From Wordpress)

Linking Posts, Pages, and Categories
Something like: Post Title should work even if you use permalinks.

use below code to get particular post url and Title only by post id.
replace $postid with your post id that you want to display.
$postid = 1;
echo ''.get_the_title($postid).'';

Related

How to do Wordpress Custom Post multiple rewrite?

how to rewrite below custom post in Wordpress
Live
http://example.org/custompost/post-title
Need as
http://example.org/category/subcategory/custompost-title
You need to update permalink from wp-admin/options-permalink.php here
Select "Custom Structure" and add this pattern after site URL /%category%/%postname%/.
Now create category and subcategory for post types and assign child category to specific post like (if I have a test(parent) and test2(child) and create test post type then I will select child category (test2) only).
Now you can able to see your pattern in post URL like http://example.org/category/subcategory/custompost-title

WordPress category link

I am trying to create an online store from scratch, with categories and product pages.
Since is my first WordPress store I'm stuck on this trivial problem which stopped me on my way.
The permalinks are set to Month and name just to know the settings.
I created several categories where I want to insert the future products.
The problem arise when I try to access a certain category link - www.mysite.com/category/books/ - it displays the error page.
If I access www.mysite.com/category/ it shows me the content of the category page created in the admin panel.
All I want to do is to display all books when the visitor clicks on www.mysite.com/category/books/ and so on.
It is simple. Go to wp-admin/options-permalink.php and make your own settings: /%category%/%postname%/
And add a prefix on the field below: category or whatever you want
Read here for more options
Actually I solved it in another way, by modifying the category.php page.
There I inserted this code :
$uri = $_SERVER['REQUEST_URI'];
$elms = explode('/', $uri) ;
$catName = $elms[4] ;
and it does the thing I need.

How to create a costum template structure like for pages and post but for different entities like hotels, products etc

Hi everyone I am creating a wordpress theme and a custom plug-in which is related to hotel booking and display the information on the front end entered in the back end in admin panel of wordpress .
so friends whenever a post is displayed the url is like http://localhost/wordpress/uncategorized/post10/ and the name of the post or id of the post changes in a url but at the back end only single.php template get used by wordpress again and again so my question is can wee create something like that for different things for example in my case to display hotel only hotel.php file get used again and again and in url only the id of the hotel changes .
I didn't searched much about this on internet but I have seen something like that in wp-e-commerce plugin in which there is a separate template files to display the categories of products and also for products and those files are in the plugin directory.
You should first create custom post type (you will find plugins for that), for example a hotel post type.
Then you can easily create specific template for this post type, for example single-hotel.php.
More on codex :
http://codex.wordpress.org/Post_Types#Custom_Types
http://codex.wordpress.org/Post_Types#Template_Files

Wordpress generated page with values from url

I'm currently trying to build a wordpress product catalog with a custom taxonomy.
I'd like to have browseable multi-level category system, so if I click the Catalog menu, it would show all the top parent categories, and if I click on one of these categories, instead of showing me the posts in that particular category, I want it to list all it's subcategories.
For this I'm using two slightly modified plugins currently:
Multi column taxonomy list, and taxonomy images.
My approach would be to have the taxonomy lister display custom links linke www.xyz.com/wp/product?cat=doors
and the product page would process the $_GET data cat and forward it to the shortcode somehow so it would be [mctl taxonomy='productcategories' parent='$_GET['parentid']']
.
So for the TLDR: How can I pass variables from the URL to the shortcode, or to the plugin.
Thanks for any help.
Nevermind, I figured it out. I just had to edit the plugins php and use the $_GET[''] stuff there.

Make a wordpress category into a page

So in wordpress, I have a list of pages in my navigation. Home - Videos - Blog
The "Home" shows every blog post regardless of category. How can I make the Videos and Blog show specifically every post from the "blog" category or the "videos".
Thanks
Greg
You can do this a couple of ways.
First, this functionality is built into WordPress. Every category can be called by a URL:
http://www.yoursite.com/category/category-slug/
The /category/ part of the URL is the WordPress default and you can change it under Settings | Permalinks in the Optional section.
The second way would be to create a custom page template and use the query_posts() function to include or exclude whatever categories you wish. The syntax is:
query_posts( 'cat=1' );
To get all posts in category ID 1 (use Posts | Categories to get the ID numbers). If you want a page with two categories:
query_posts( 'cat=1,3' );
To exclude a category and return everything else:
query_posts( 'cat=-5' );
query_posts() is pretty flexible and takes a bunch of different arguments. You could do worse than to read the Codex article for it.
If you are using WordPress with BlueHost, click on Appearance -> Menus. Under "Menu Items," hit "Categories." Select the category you want to transform into a page and click "Add to Menu." The category will become a page on your menu. Now every blog post assigned to that category will appear only on the corresponding page.

Resources