0

I dont know how to call it, but can I switch off auto linking in Wordpress?

I am creating my 3. theme for client, but I have not manage this problem.

For example, if I create a page or post, Wordpress automatically create a permalink on my site, www.mysite.com/posttitle. But if I wanna use this post to display it into the home page, for example it have only few lines, like copyrights or whatever.

So I create new page/post and display it into my theme by query_posts. And all is fantastic, until I type www.mysite/copyright and there I can see only my copyrights.

How do you manage this kind of problem? Of course I can hard code it into my template, but it isnt a solution form me.

I hope you get my thought.

UPDATE. Ok I found better example :

If I wanna create portfolio page where will be all my work. So I create new template file, than new page, new category and add new posts to that category.

So I have that page mysite.com/portfolio and there is all those posts ( works ). Just title, picture and some small description.

But wordpress is automatically creating those links mysite.com/portfolio/work1, but I dont wanna it.

1 Answer 1

0

You don't have to create a post to hold your data, you can use the Settings API

for example you put in your functions.php:

$copyright = get_option('my_them_copyright');
if (!isset($copyright)){
    $copyright =  'Design by: <a href="domain.com">ME</a>';
    update_option('my_them_copyright',$copyright);
}

and then whenever you want to call it you use get_option() like this:

$copyright = get_option('my_them_copyright');
echo $copyright;

Update

like i commented any post/page will get a permalink automatically but what you can do is register your own post type

<?php
add_action('init', 'register_generic_data');
function register_generic_data()   
{
  $labels = array(
    'name' => _x('Generic Data', 'post type general name'),
    'singular_name' => _x('Generic Data', 'post type singular name'),
    'add_new' => _x('Add New', 'Generic Data'),
    'add_new_item' => __('Add New Generic Data'),
    'edit_item' => __('Edit Generic Data'),
    'new_item' => __('New Generic Data'),
    'view_item' => __('View Generic Data'),
    'search_items' => __('Search Generic Data'),
    'not_found' =>  __('No Generic Data found'),
    'not_found_in_trash' => __('No Generic Data found in Trash'), 
    'parent_item_colon' => ''
  );
  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => false,
    'exclude_from_search' => true,
    'show_in_nav_menus' => false,
    'show_ui' => true, 
    'query_var' => false,
    'rewrite' => false,
    'capability_type' => 'post',
    'hierarchical' => true,
    'menu_position' => 20,
    'supports' => array('title','editor','author','thumbnail','excerpt','trackbacks','custom-fields','comments','revisions','page-attributes'),
    'taxonomies' => array('category','post_tag')
  ); 
  register_post_type('gen_data',$args);
};?>

Now if you take a close look at this part:

    'publicly_queryable' => false,
    'exclude_from_search' => true,
    'show_in_nav_menus' => false,
    'query_var' => false,
    'rewrite' => false,
    'show_ui' => true, 

you can see that we set the post type to have a ui and to show in the admin menu but other then that its "none public".

so you can create your portfolio posts using this post type or any other "generic data types" that need post capabilities.

6
  • Ok, this solution for copyrights is grate, but if I wanna something bigger to display on my template? For example some "tour dates" table? I wanna display it just in footer (or whatever). Creating "page" and displaying into footer template is very good solution, but I don't wanna create permalink www.mysite.com/tourdates Mar 9, 2011 at 13:30
  • any page will get a permalink automatically, you can change it to what you want but you can't avoid it, also options table can hold your "tour dates table" data and you can even create an option page to updated it and even use the TinyMCE editor, creating a page to hold data for something other then a page is simply a wrong approach.
    – Bainternet
    Mar 9, 2011 at 13:39
  • Ok, but take a look on this example - img34.imageshack.us/i/examplecj.jpg . The best way ( or not? ) is to create new category and add 6 new post to that category. Than client can easily add new post to that category only entering the title and image. And then it will show on this page 7 items. But bad thing is, that wordpress will also create post permalinks, witch I dont wanna. So have you would solve this problem? Mar 9, 2011 at 14:01
  • So I mean if I create just page and add the content in 3x2 table for me it would be ok, when client would wanna to add new "product" in that page, it would be hard for him. Easier for him would be to create new post ( add the title and image) and select the category. And that "product" would show into that page. Mar 9, 2011 at 15:08
  • I updated my post with "better" example Mar 9, 2011 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.