hi
ich versuch euch das mal so gut es geht zu erkären was ich vorhab :D
hab dieses "alphabet listing" plugin runtergeladen, was aber nicht alles zu meinen wünschen macht..
hab das auf den einzelnen seiten eingebuden auf der der inhalt bestimmter kategorien angezeigt wird.
im moment hab ich einzelnde "buttons" a-z, die bei cursor auf dem button "a" z.b. in nem pull-down-menü dann alles nach "a" sortiert anzeigt..
ich will das aber so haben, dass man bei "click" auf ne neue seite geleitet wird, die dann dort alles nach "a" sortiert gelistet ist.. ( WICHTIG!: es soll NUR der inhalt angezeigt werden, von der seite wo man sich gerade befindet. d.h. ich bin z.b. im moment auf der seite wo news angezeigt werden, dann nur die news nach "a" sortieren)
hier mal der momentane code..bin leider ein anfänger in php kann deshalb nur bedingt copy-pasten und bisschen verändern...
hier wirds auf der seite eingebuden:
<div id="newsContent">
<div class="categoryList">
<?php
echo do_shortcode('[atoz type="posts"]');
$cats = get_categories('hide_empty=1&exclude=15&orderby=menuorder');
foreach($cats as $category) {
echo '<h1 class="entry-title">';
if(has_category_thumbnail($category->term_id)) {
the_category_thumbnail($category->term_id);
}else{
echo ' <a href="'.get_category_link( $category->term_id ).'" title="'.$category->description.'">'.$category->name.'</a>';
}
echo'</h1>';
echo'<ul>';
$recent = new WP_Query("cat=".$category->term_id."&showposts=5&order=ASC&orderby=title");
while($recent->have_posts()) : $recent->the_post();
echo'<li><a href="'; the_permalink(); echo '">'; the_title(); echo'</a></li>';
endwhile;
wp_reset_postdata();
echo'</ul> <br />';
echo'<div class="morenews"><a href="'.get_category_link( $category->term_id ).'" title="'.$category->description.'">...und '.$category->count.' weitere.</a></div><div class="clear"></div>';
}
?>
</div><!-- #catlist -->
</div><!-- #content -->
Alles anzeigen
und hier die einzelnen plugin-phps...
[size=8]
[/SIZE]
[size=8]alphabet_listing_settings.php[/SIZE]
<?php
if (!isset($wp_al_plugin))
{
$new_options = array(
'title' => 'A to Z listing',
'type' => 'post',
'bg_colour' => '#f0f0f0',
'text_colour' => '#424242'
);
add_option('alphabet-listing-settings',$new_options);
}
?>
<div class="wrap">
<h2>Settings</h2>
<?php if( isset($_GET['settings-updated']) ) { ?>
<div id="message" class="updated">
<p><strong><?php _e('Settings saved.') ?></strong></p>
</div>
<?php } ?>
<form method="post" action="options.php">
<?php
settings_fields('alphabet-listing-settings-group');
$wp_al_options = get_option('alphabet-listing-settings');
?>
<table class="form-table">
<tr valign="top">
<th scope="row">Listing Title</th>
<td><input type="text" name="alphabet-listing-settings[title]" value="<?php echo $wp_al_options['title']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Listing Type</th>
<td><input type="text" name="alphabet-listing-settings[type]" value="<?php echo $wp_al_options['type']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Background Color</th>
<td><input type="text" name="alphabet-listing-settings[bg_colour]" value="<?php echo $wp_al_options['bg_colour']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Text Color</th>
<td><input type="text" name="alphabet-listing-settings[text_colour]" value="<?php echo $wp_al_options['text_colour']; ?>" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>
Alles anzeigen
[size=8]alphabet_listing.php[/SIZE]
<?php
/*
Plugin Name: Alphabet Listing
Plugin URI: http://www.tipsandtricks-hq.com/?p=4873
Description: Can be used to list post, page or categories with A to Z listing anywhere on your WordPress site
Version: 1.2
Author: Tips and Tricks HQ
Author URI: http://www.tipsandtricks-hq.com/
License: GPL2
*/
//initialize class
if (!class_exists("AplhabetPlugin")) {
define('AL_PATH', plugin_dir_path( __FILE__ ) );
define('AL_URL', plugin_dir_url( __FILE__ ) );
define('AL_NAME', 'Alphabet Listing');
define('AL_DIRECTORY', 'alphabet-listing');
define('AL_VERSION', '1.0.0' );
define('AL_BUILD', '1' );
// i18n plugin domain for language files
define( 'AL_I18N_DOMAIN', 'aplhabet_listing' );
require_once(AL_PATH . '/alphabet_listing_main.php');
}
$wp_al_plugin = new AlphabetPlugin();
//Actions and Filters
if (isset($wp_al_plugin)) {
//int
$wp_al_plugin->aplhabet_listing_set_lang_file();
//Actions
add_action( 'wp_enqueue_scripts', array($wp_al_plugin,'inject_css'));
add_action( 'admin_init', array($wp_al_plugin,'aplhabet_listing_register_settings'));
add_action( 'admin_menu', array($wp_al_plugin,'alphabet_listing_create_menu'));
//register hooks
register_activation_hook(__FILE__, array($wp_al_plugin,'aplhabet_listing_activate'));
register_deactivation_hook(__FILE__, array($wp_al_plugin,'aplhabet_listing_deactivate'));
//Filters
add_shortcode( 'atoz', array($wp_al_plugin,'atoz_shortcode') );
if (!is_admin())
{add_filter('widget_text', 'do_shortcode');}
add_filter('the_excerpt', 'do_shortcode',11);
}
Alles anzeigen
vielleicht hat ja jemand ne idee oder eventuell gibts da ja schon ne integrierte lösung, die ich nur nicht gefunden habe...ich bedanke mich schonmal im vorraus für jeden beitrag.
/edit: im nächsten post die letzte php wegen zeichenüberschreitung