Make WordPress Core

Changeset 2746


Ignore:
Timestamp:
08/03/2005 01:50:56 AM (19 years ago)
Author:
matt
Message:

Better permalink interface, marginally

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r2639 r2746  
    8888<?php endif; ?>
    8989
    90 <?php do_action('admin_head', ''); ?>
     90<?php do_action('admin_head'); ?>
    9191</head>
    9292<body>
  • trunk/wp-admin/options-permalink.php

    r2315 r2746  
    44$title = __('Permalink Options');
    55$parent_file = 'options-general.php';
     6
     7function add_js() {
     8?>
     9<script type="text/javascript">
     10    //<![CDATA[
     11        function GetElementsWithClassName(elementName, className) {
     12           var allElements = document.getElementsByTagName(elementName);
     13           var elemColl = new Array();
     14           for (i = 0; i < allElements.length; i++) {
     15               if (allElements[i].className == className) {
     16                   elemColl[elemColl.length] = allElements[i];
     17               }
     18           }
     19           return elemColl;
     20        }
     21       
     22        function upit() {
     23           var inputColl = GetElementsWithClassName('input', 'tog');
     24           var structure = document.getElementById('permalink_structure');
     25           var inputs = '';
     26           for (i = 0; i < inputColl.length; i++) {
     27               if ( inputColl[i].checked && inputColl[i].value != '') {
     28                    inputs += inputColl[i].value + ' ';
     29                    }
     30               }
     31           inputs = inputs.substr(0,inputs.length - 1);
     32            if ( 'custom' != inputs )
     33               structure.value = inputs;
     34           }
     35       
     36        function blurry() {
     37           if (!document.getElementById) return;
     38       
     39           var aInputs = document.getElementsByTagName('input');
     40       
     41           for (var i = 0; i < aInputs.length; i++) {       
     42               aInputs[i].onclick = aInputs[i].onkeyup = upit;
     43           }
     44        }
     45       
     46        window.onload = blurry;
     47    //]]>
     48    </script>
     49<?php
     50}
     51add_filter('admin_head', 'add_js');
    652
    753include('admin-header.php');
     
    5399
    54100<div class="wrap">
    55   <h2><?php _e('Edit Permalink Structure') ?></h2>
    56   <p><?php _e('By default WordPress uses web URIs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URI structure for your permalinks and archives. This can improve the aesthetics, usability, and longevity of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
     101  <h2><?php _e('Customize Permalink Structure') ?></h2>
     102  <p><?php _e('By default WordPress uses web URIs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URI structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
    57103
     104<?php
     105$prefix = '';
     106if ( !$is_apache )
     107    $prefix = '/index.php';
     108?>
     109<form name="form" action="options-permalink.php" method="post">
     110<h3><?php _e('Common options:'); ?></h3>
     111<p>
     112    <label>
     113<input name="selection" type="radio" value="<?php echo $prefix; ?>/%year%/%monthnum%/%day%/%postname%/" class="tog" <?php checked( $prefix . '/%year%/%monthnum%/%day%/%postname%/', $permalink_structure); ?> />
     114<?php _e('Date and name based, example:'); ?> <code><?php echo get_settings('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code>
     115   </label>
     116</p>
     117<p>
     118    <label>
     119<input name="selection" type="radio" value="<?php echo $prefix; ?>/archives/%post_id%" class="tog" <?php checked( $prefix . '/archives/%post_id%', $permalink_structure); ?> />
     120<?php _e('Numeric, example:'); ?> <code><?php echo get_settings('home') . $prefix  ; ?>/archives/123</code>
     121   </label>
     122</p>
     123<p>
     124<label>
     125<input name="selection" type="radio" value="custom" class="tog"
     126<?php if ( $permalink_structure != $prefix . '/archives/%post_id%' && $permalink_structure != $prefix . '/%year%/%monthnum%/%day%/%postname%/' ) { ?>
     127checked="checked"
     128<?php } ?>
     129 />
     130<?php _e('Custom, specify below'); ?>   
     131</label>
     132<br />
     133</p>
     134<p id="customstructure"><?php _e('Custom structure'); ?>: <input name="permalink_structure" id="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo $permalink_structure; ?>" size="50" /></p>
     135
     136<h3><?php _e('Optional'); ?></h3>
    58137<?php if ($is_apache) : ?>
    59 <dl>
    60 <dt><?php _e('Structure'); ?>: <code>/%year%/%monthnum%/%day%/%postname%/</code></dt>
    61     <strong>
    62     <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home') . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></dd>
    63     </strong>
    64     <dt><?php _e('Structure'); ?>: <code>/archives/%post_id%</code></dt>
    65     <strong>
    66     <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home'); ?>/archives/123</code></dd>
    67     </strong>
    68     <dt></dt>
    69 </dl>
    70 
    71 <p><?php _e('For the above to work you must have something called <code>mod_rewrite</code> installed on your server. (Ask your host.) If that isn&#8217;t available, you can prefix the structure with <code>/index.php/</code> . This is the recommend method if you are on any web server but Apache.'); ?></p>
    72 
     138    <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/taxonomy/tags</code> would make your category links like <code>http://example.org/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
    73139<?php else : ?>
    74 <dl>
    75 <dt><?php _e('Structure'); ?>: <code>/index.php/%year%/%monthnum%/%day%/%postname%/</code></dt>
    76     <strong>
    77     <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home') . '/index.php/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></dd>
    78     </strong>
    79     <dt><?php _e('Structure'); ?>: <code>/index.php/archives/%post_id%</code></dt>
    80     <strong>
    81     <dd><?php _e('Result'); ?>: <code><?php echo get_settings('home'); ?>/index.php/archives/123</code></dd>
    82     </strong>
    83     <dt></dt>
    84 </dl>
    85 <?php endif; ?>
    86 
    87   <form name="form" action="options-permalink.php" method="post">
    88     <p><?php _e('Use the template tags above to create a virtual site structure:') ?></p>
    89     <p>
    90       <?php _e('Structure'); ?>: <input name="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo $permalink_structure; ?>" size="50" />
    91     </p>
    92 <?php if ($is_apache) : ?>
    93     <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/taxonomy/categorias</code> would make your category links like <code>http://example.org/taxonomy/categorias/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
    94 <?php else : ?>
    95     <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/index.php/taxonomy/categorias</code> would make your category links like <code>http://example.org/index.php/taxonomy/categorias/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
     140    <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/index.php/taxonomy/tags</code> would make your category links like <code>http://example.org/index.php/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p>
    96141<?php endif; ?>
    97142    <p>
Note: See TracChangeset for help on using the changeset viewer.