Antworten auf deine Fragen:
Neues Thema erstellen

Antworten zum Thema „Hilfe Wordpress wirft Parse Fehler aus“

Vagant

Nicht mehr ganz neu hier

Hallo, ich habe ein Wordpress Template installiert.
Nun wirft mir der Aufruf folgenden Fehler aus:

Parse error: syntax error, unexpected ')' in /users/asel/www/wp-content/themes/Learning_Brown1/library/navigation.php on line 271

Die Zeilen sehen so aus:


[FONT=&quot]function theme_MenuItem($args = '') {[/FONT] [FONT=&quot] $args = wp_parse_args($args, [/FONT]
[FONT=&quot] array([/FONT]
[FONT=&quot] 'id' => '',[/FONT]
[FONT=&quot] 'active' => false,[/FONT]
[FONT=&quot]'parent' => 0,[/FONT]
[FONT=&quot] 'attr' => '',[/FONT]
[FONT=&quot]'title' => '',[/FONT]
[FONT=&quot] )[/FONT]
[FONT=&quot] );[/FONT]
[FONT=&quot] $this->id = $args['id'];[/FONT]
[FONT=&quot] $this->active = $args['active'];[/FONT]
[FONT=&quot] $this->parent = $args['parent'];[/FONT]
[FONT=&quot] $this->attr = $args['attr'];[/FONT]
[FONT=&quot] $this->title = $args['title'];[/FONT]
[FONT=&quot] }[/FONT]

[FONT=&quot] function get_start($level){[/FONT]
[FONT=&quot] $class = ($this->active ? 'active' : '');[/FONT]
[FONT=&quot] $title = apply_filters('the_title', $this->title, $this->id);[/FONT]
[FONT=&quot] if (theme_get_option('theme_menu_trim_title')) {[/FONT]
[FONT=&quot] $title = theme_trim_long_str($title, theme_get_option($level == 0 ? 'theme_menu_trim_len' : 'theme_submenu_trim_len'));[/FONT]
[FONT=&quot] }[/FONT]
[FONT=&quot] return str_repeat("\t", $level+1) [/FONT]
[FONT=&quot] . '<li' . theme_prepare_attr(array('class' => $class)) . '>' [/FONT]
[FONT=&quot] . '<a' . theme_prepare_attr($this->attr) . '>' [/FONT]
[FONT=&quot] . ($level == 0 ? '<span class="l"> </span><span class="r"> </span><span class="t">' : '') [/FONT]
[FONT=&quot] . $title [/FONT]
[FONT=&quot] . ($level == 0 ? '</span>' : '')[/FONT]
[FONT=&quot] . '</a>'. "\n";[/FONT]
[FONT=&quot] }[/FONT]

[FONT=&quot] function get_end($level){[/FONT]
[FONT=&quot] return str_repeat("\t", $level+1) . [/FONT][FONT=&quot]'</li>' . [/FONT][FONT=&quot]"\n";[/FONT]
[FONT=&quot] }[/FONT]
[FONT=&quot]}[/FONT]


[FONT=&quot]Die rot markierte Zeile ist die benannte Zeile 271[/FONT]


[FONT=&quot]Was genau habe ich denn falsch gemacht?

PS ich habe dies Doppelt gepostet weil ich es zuvor in ein Falsches Topic gesetzt habe. Vielleicht kann man das andere löschen?

[/FONT]
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

Ich wollte das Menu auf 40 Zeichen begrenzen, offenbar habe ich dabei ein Fehler gemacht.
Ich habe jedoch den inhalt wieder so hergestellt wie es zuvor war...meinte ich
 

Duddle

Posting-Frequenz: 14µHz

AW: Hilfe Wordpress wirft Parse Fehler aus

Ich sehe keinen Fehler in der hervorgehobenen Zeile. Es kann sein, dass sich die Zeilenangaben verschoben haben, falls in der Datei includes passieren. Zum Test kannst du die Zeile auskommentieren und schauen ob weiterhin der gleiche Fehler kommt. Falls ja, ist eine andere Zeile der Verursacher.


Duddle
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

Hier mal der vollständige Code:

<?php

function theme_get_menu($args = '')
{
$args = wp_parse_args( $args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => ''));
$source = &$args['source'];
$menu = &$args['menu'];
if (function_exists('get_nav_menu_locations') && $menu != null && is_string($menu)) { // theme location
$location = theme_get_array_value(get_nav_menu_locations(), $menu);
if ($location) {
$menu = wp_get_nav_menu_object($location);
if($menu) $source = 'Custom Menu';
}
}

if ($source == 'Custom Menu' && function_exists('wp_nav_menu') && $menu != null) {
return theme_get_list_menu($args);
}

if ($source == 'Pages') {
return theme_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args));
}

if ($source == 'Categories') {
return theme_get_list_categories(array_merge(array('title_li'=> false), $args));
}
}

/* custom menu */
function theme_get_list_menu($args = array()) {
global $wp_query;
$menu_items = wp_get_nav_menu_items($args['menu']->term_id);
if(empty($menu_items)) return '';
$home_page_id = (int) get_option('page_for_posts');
$queried_object_id = (int) $wp_query->queried_object_id;
$active_ID = null;

$IdToKey = array();
foreach ( (array) $menu_items as $key => $menu_item ) {
$IdToKey[$menu_item->ID] = $key;
if ($menu_item->object_id == $queried_object_id &&
(
( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) ||
( 'post_type' == $menu_item->type && $wp_query->is_singular ) ||
( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ))
)
)
{
$active_ID = $menu_item->ID;
} elseif ( 'custom' == $menu_item->object ) {
if ( theme_is_current_url($menu_item->url)) {
$active_ID = $menu_item->ID;
}
}
}

$current_ID = $active_ID;
while ($current_ID && isset($IdToKey[$current_ID])) {
$activeIDs[] = $current_ID;
$current_item = &$menu_items[$IdToKey[$current_ID]];
$current_item->classes[] = 'active';
$current_ID = $current_item->menu_item_parent;
}

$sorted_menu_items = array();
foreach ((array) $menu_items as $key => $menu_item) {
$sorted_menu_items[$menu_item->menu_order] = wp_setup_nav_menu_item($menu_item);
}

$items = array();
foreach ($sorted_menu_items as $el) {
$id = $el->db_id;
$title = $el->title;
$classes = empty( $el->classes ) ? array() : (array) $el->classes;
$active = in_array('active', $classes);
$items[] = new theme_MenuItem(array(
'id' => $id,
'active' => $active,
'attr' => array(
'title' => (empty($el->attr_title) ? $title : $el->attr_title),
'target' => $el->target,
'rel' => $el->xfn,
'href' => $el->url,
'class' => join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $el))
),
'title' => $title,
'parent' => $el->menu_item_parent
));
}

$walker = new theme_MenuWalker();
$items = $walker->walk($items, $args);
$items = apply_filters('wp_nav_menu_items', $items, $args);
$items = apply_filters("wp_nav_menu_{$menu->slug}_items", $items, $args);
return apply_filters('wp_nav_menu', $items, $args);
}

/* pages */
function theme_get_list_pages($args = array()) {
global $wp_query;
$pages = &get_pages($args);
if (empty($pages)) return '';

$IdToKey = array();
$currentID = null;

foreach ($pages as $key => $page)
{
$IdToKey[$page->ID] = $key;
}

if ($wp_query->is_page) {
$currentID = $wp_query->get_queried_object_id();
}

$frontID = null;
$blogID = null;

if ('page' == get_option('show_on_front')) {

$frontID = get_option('page_on_front');
if ($frontID && isset($IdToKey[$frontID])) {
$frontKey = $IdToKey[$frontID];
$frontPage = $pages[$frontKey];
unset($pages[$frontKey]);
$frontPage->post_parent = 0;
$frontPage->menu_order = 0;
array_unshift($pages, $frontPage);
$IdToKey = array();
foreach ($pages as $key => $page)
{
$IdToKey[$page->ID] = $key;
}
}

if (is_home()) {
$blogID = get_option('page_for_posts');
if ($blogID && isset($IdToKey[$blogID]))
{
$currentID = $blogID;
}
}
}

$active_Id = $currentID;
$activeIDs = array();
while($active_Id && isset($IdToKey[$active_Id]))
{
$active = $pages[$IdToKey[$active_Id]];
if ($active && $active->post_status == 'private') break;
$activeIDs[] = $active->ID;
$active_Id = $active->post_parent;
}

$items = array();
if (theme_get_option('theme_menu_showHome') && ('page' != get_option('show_on_front') || (!get_option('page_on_front') && !get_option('page_for_posts'))))
{
$title = theme_get_option('theme_menu_homeCaption');
$active = is_home();
$items[] = new theme_MenuItem(array(
'id' => 'home',
'active' => $active,
'attr' => array('class' => ($active ? 'active' : ''), 'href' => get_home_url(), 'title' => $title),
'title' => $title,
));
}
foreach ($pages as $page) {
$id = $page->ID;
$title = $page->post_title;
$active = in_array($id, $activeIDs);
$href = (($frontID && $frontID == $id) ? get_option('home') : get_page_link($id));
$separator = theme_get_meta_option($id, 'theme_show_as_separator');
if ($separator) {
$href = '#';
}
$items[] = new theme_MenuItem(array(
'id' => $id,
'active' => $active,
'attr' => array('class' => ($active ? 'active' : ''), 'href' => $href, 'title' => $title),
'title' => $title,
'parent' => $page->post_parent
));
}

$walker = new theme_MenuWalker();
return $walker->walk($items, $args);
}

/* categories */
function theme_get_list_categories($args = array()) {
global $wp_query, $post;
$categories = &get_categories($args);
if (empty($categories)) return '';
$IdToKey = array();
foreach ($categories as $key => $category){
$IdToKey[$category->term_id] = $key;
}

$currentID = null;
if ($wp_query->is_category)
{
$currentID = $wp_query->get_queried_object_id();
}

$activeID = $currentID;
$activeIDs = theme_get_category_branch($currentID, $categories, $IdToKey);
if(theme_get_option('theme_menu_highlight_active_categories') && is_single()){
foreach((get_the_category($post->ID)) as $cat) {
$activeIDs = array_merge($activeIDs, theme_get_category_branch($cat->term_id, $categories, $IdToKey));
}
}
$items = array();
foreach ($categories as $category) {
$id = $category->term_id;
$title = $category->name;
$desc = (($category->description) ? $category->description : sprintf(__('View all posts in %s', THEME_NS), $title));
$active = in_array($id, $activeIDs);
$items[] = new theme_MenuItem(array(
'id' => $id,
'active' => $active,
'attr' => array('class' => ($active ? 'active' : ''), 'href' => get_category_link($id), 'title' => $desc),
'title' => $title,
'parent' => $category->parent
));
}

$walker = new theme_MenuWalker();
return $walker->walk($items, $args);
}

//Helper, return array( 'id', 'parent_id', ... , 'root_id' )
function theme_get_category_branch($id, $categories, $IdToKey) {
$result = array();
while ($id && isset($IdToKey[$id])) {
$result[] = $id;
$id = $categories[$IdToKey[$id]]->parent;
}
return $result;
}


/* menu item */
class theme_MenuItem {
var $id;
var $active;
var $parent;
var $attr;
var $title;

function theme_MenuItem($args = '') {
$args = wp_parse_args($args,
array(
'id' => '',
'active' => false,
'parent' => 0,
'attr' => '',
'title' => '',
)
);
$this->id = $args['id'];
$this->active = $args['active'];
$this->parent = $args['parent'];
$this->attr = $args['attr'];
$this->title = $args['title'];
}

function get_start($level) {
$class = ($this->active ? 'active' : '');
$title = apply_filters('the_title', $this->title, $this->id);
if (theme_get_option('theme_menu_trim_title'))
{
$title = theme_trim_long_str($title, theme_get_option($level == 0 ? 'theme_menu_trim_len' : 'theme_submenu_trim_len'))
}
return str_repeat("\t", $level+1)
. '<li' . theme_prepare_attr(array('class' => $class)) . '>'
. '<a' . theme_prepare_attr($this->attr) . '>'
. ($level == 0 ? '<span class="l"> </span><span class="r"> </span><span class="t">' : '')
. $title
. ($level == 0 ? '</span>' : '')
. '</a>'. "\n";
}

function get_end($level){
return str_repeat("\t", $level+1) . '</li>' . "\n";
}
}

/* menu walker */
class theme_MenuWalker {

var $child_Ids = array();
var $IdToKey = array();
var $level = 0;
var $items;
var $depth;
var $args;
var $class;

function walk($items = array(), $args = '') {
$args = wp_parse_args($args, array('depth' => 0, 'class' => ''));
$this->items = &$items;
$this->depth = (int)$args['depth'];
$this->class = $args['class'];
foreach($items as $key => $item) {
$this->IdToKey[$item->id] = $key;
if (!isset($this->child_Ids[$item->parent])) {
$this->child_Ids[$item->parent] = array();
}
$parent = $item->parent;
if (!$parent) $parent = 0;
$this->child_Ids[$parent][] = $item->id;
}

$output = '';
if (isset($this->child_Ids[0])) {
$this->display($output, $this->child_Ids[0]);
}
if (theme_is_empty_html($output)) return '';
return "\n" .'<ul' .theme_prepare_attr(array('class' => $this->class)) .'>' ."\n" .$output .'</ul>'."\n";
}

function display(&$output, $child_Ids) {
if (!is_array($child_Ids)) return;
$first = true;
foreach($child_Ids as $child_Id){
if (!isset($this->IdToKey[$child_Id])) continue;
$item = $this->items[$this->IdToKey[$child_Id]];
if ($this->class == 'art-hmenu' && !$first && $this->level == 0) {
$output .= "\t" .'<li class="art-hmenu-li-separator"><span class="art-hmenu-separator"> </span></li>' . "\n";
}
if ($this->class == 'art-vmenu') {
if ($this->level == 0) {
if(!$first) {
$output .= "\t" .'<li class="art-vmenu-separator"><span class="art-vmenu-separator-span"> </span></li>' . "\n";
}
} else {
if(($this->level == 1) && $first) {
$output .= "\t" .'<li class="art-vmenu-separator art-vmenu-separator-first"><span class="art-vmenu-separator-span"> </span></li>' . "\n";
} else {
$output .= "\t" .'<li class="art-vsubmenu-separator"><span class="art-vsubmenu-separator-span"> </span></li>' . "\n";
}
}
}
$output .= $item->get_start($this->level);
if (
($this->depth == 0 || $this->level < ($this->depth-1))
&& isset($this->child_Ids[$item->id])
&& (count($this->child_Ids[$item->id]) > 0)
) {
$this->level++;
$output .= str_repeat("\t", $this->level) . '<ul' . theme_prepare_attr(array('class' => ($item->active ? 'active' : ''))) . '>' . "\n";
$this->display($output, $this->child_Ids[$item->id]);
$output .= str_repeat("\t", $this->level) . '</ul>' . "\n";
$this->level--;
}
$output .= $item->get_end($this->level);
$first = false;
}
}

}

// Not support old wp version
if (WP_VERSION < 3.0) return;
function theme_get_pages( $pages ) {
if(is_admin()) return $pages;

$excluded_option = get_option('theme_show_in_menu');
if (!$excluded_option || !is_array($excluded_option)) return $pages;
$excluded_ids = array();
foreach ($excluded_option as $id => $show)
{
if(!$show) {
$excluded_ids[] = $id;
}
}
$excluded_parent_ids = array();
foreach ($pages as $page) {

$title = theme_get_meta_option($page->ID, 'theme_title_in_menu');
if ($title) {
$page->post_title = $title;
}

if (in_array($page->ID, $excluded_ids)){
$excluded_parent_ids[$page->ID] = $page->post_parent;
}
}

$length = count($pages);
for ( $i=0; $i<$length; $i++ ) {
$page = & $pages[$i];
if (in_array($page->post_parent, $excluded_ids)) {
$page->post_parent = theme_get_array_value($excluded_parent_ids, $page->post_parent, $page->post_parent);
}
if (in_array($page->ID, $excluded_ids)) {
unset( $pages[$i] );
}
}

if ( ! is_array( $pages ) ) $pages = (array) $pages;
$pages = array_values( $pages );

return $pages;
}
add_filter('get_pages','theme_get_pages');
 

cythux

Aktives Mitglied

AW: Hilfe Wordpress wirft Parse Fehler aus

PHP:
{
$title = theme_trim_long_str($title, theme_get_option($level == 0 ? 'theme_menu_trim_len' : 'theme_submenu_trim_len')); // hier wurde mir ein syntex error angezeigt, so wie ist er korriergt hoffe das war das problem
}

lg
 

Duddle

Posting-Frequenz: 14µHz

AW: Hilfe Wordpress wirft Parse Fehler aus

In dieser Version fehlt ein Semikolon am Ende der genannten Zeile.

Das einfachste wäre wohl, das Original nochmal runterzuladen und die Datei zu ersetzen. Wer weiß, welche Fehler du aus Versehen noch reingearbeitet hast.


Duddle
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

Ich habe es mal online geprüft und es scheint die schliessende }in 273 zu sein, aber ich verstehe nciht warum....
 

cythux

Aktives Mitglied

AW: Hilfe Wordpress wirft Parse Fehler aus

ich habe dieses Theme leider nicht sonst würde ich es mal local hochladen zum testen. Gefunden schaue es mir mal an
 
Zuletzt bearbeitet:

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

ich habe jetzt den Original Code wieder eingefügt.
Die Fehlermeldung bleibt jedoch....
 

cythux

Aktives Mitglied

AW: Hilfe Wordpress wirft Parse Fehler aus

Bei mir auf Xampp hatte ich keine Fehlermeldung, funktionierte einwandfrei sogar mit dem Themecheck
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

Ich glaube ich habe ein generelles Problem das Wordpress zwar sagt es habe die Datei aktualisiert, es aber tatsächlich nicht tut.
Ich werde die Datei wohl komplett neu aufspielen müssen, dann wird es wohl gehen. Melde mich dann wieder.
Danke für die Hilfe.
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

So nun läuft es wieder, aber ich habe nun nach wie vor das Problem in der Menu Führung. Die Menüs werden einfach abgeschnitten.

ist die Domain.

Kann mir jemand sagen wie ich die Breite der Menüs ändern kann?
 
Zuletzt bearbeitet:

Rata

AW: Hilfe Wordpress wirft Parse Fehler aus

So nun läuft es wieder, aber ich habe nun nach wie vor das Problem in der Menu Führung. Die Menüs werden einfach abgeschnitten.

www.wissen-fuer-fachwirte.de ist die Domain.


Mac® - stinkender Puma, Safari 6.0.4, da werden die Menüs – zumindest im Moment – nicht abgeschnitten. Welchen Browser nutzt Du denn?

Wäre aber keine Meldung wert ;) Wichtiger: Nimm doch mal das h aus Deinen Authoren raus! Muß jetzt erst mal ein Mittagsschläfchen halten, damit ich meinen Schock vergesse :D ... man/frau/kind sieht, jeder Vorwand ist Rata willkommen 8)



Lieber Gruß
Rata

8)
 

cythux

Aktives Mitglied

AW: Hilfe Wordpress wirft Parse Fehler aus

Screenshoot

änderung via css :

Code:
.art-blockheader h3.t {
position: relative;
height: 36px;
color: #000000;
font-size: 12px;
letter-spacing: normal;
text-transform: uppercase;
margin: 0;
/* padding: 0 10px 0 10px; */
white-space: nowrap;
line-height: 36px;

/*
#art-main, table {
font-family: Georgia, "Times New Roman", Times, Serif;
font-style: normal;
font-weight: normal;
font-size: 12px;
letter-spacing: 1px;
}*/
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

Klasse das funktioniert. Kann man das auf die Submenüs auch übertragen?
 

Vagant

Nicht mehr ganz neu hier

AW: Hilfe Wordpress wirft Parse Fehler aus

Geschafft.
Aber sag mir, wieso hast du dies raus genommen:


Code:
/* #art-main, table { font-family: Georgia, "Times New Roman", Times, Serif; font-style: normal; font-weight: normal; font-size: 12px; letter-spacing: 1px; }*/
 
Zuletzt bearbeitet:
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Flatrate für Tutorials, Assets, Vorlagen

Statistik des Forums

Themen
175.155
Beiträge
2.581.856
Mitglieder
67.222
Neuestes Mitglied
Gregor
Oben