Forum Replies Created
-
AuthorPosts
-
moccaMember
Oh, I have this id also. It was just cropped in the screenshot.
As you couldn't find a mistake in the functions.php I searched the error somewhere else. Finally I found it in the WP admin 🙂 The default layout was set to the one with the sidebar. I changed the setting to full page et voilà 🙂
Thank you very much for your support, Victor!!!
moccaMemberIn the meantime I tried to find out which part in the functions.php moves the sidebar within the site-footer. It’s the code in the footer section (line 133ff). I want to move the site-footer div and the footer-widget div into the site-container with this code. When I delete the code in this footer section of my functions.php the sidebar is placed between the site-container and the footer-widget div. It doesn’t disappear but only changes its position.
The only thing I want to do is to remove it. I don’t know why it’s so persistent.
These two lines don't help:
unregister_sidebar( 'sidebar' ); unregister_sidebar( 'sidebar-alt' );
This is the link to the functions.php: https://www.dropbox.com/s/qyaf9d23er6bpbr/functions.php?dl=0
Screenshot of the DOM: https://www.dropbox.com/s/saespxdilcftki8/Bildschirmfoto%202016-06-11%20um%2023.16.28.jpg?dl=0It would be great if you could take a look on it.
moccaMemberOh, I didn't write that I had also unregistered the sidebar already. But that didn't work - but should (if you suggest it). If the code above is correct the mistake must be somewhere else.
May 21, 2016 at 6:33 pm in reply to: Why does WP ignore the content of my taxonomy-portfolio.php? #186045moccaMemberI could solve it! 🙂
This code works for me (taxonomy-work.php):
function custom_loop() { $taxonomy_terms = get_the_terms( $post->ID, 'work' ); $taxonomy_term = array(); foreach ( $taxonomy_terms as $term ) { $taxonomy_term[] = $term->slug; } $args = array( 'post_type' => 'portfolio', 'orderby' => 'menu_order', 'order' => 'ASC', // Querying for the taxonomy 'tax_query' => array( array( 'taxonomy' => 'work', 'field' => 'slug', 'terms' => $taxonomy_term, ), ), ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ): while ( $loop->have_posts() ): $loop->the_post(); global $post; // Do something endwhile; endif; }
Thank you very much for your help, Victor!
May 21, 2016 at 3:46 pm in reply to: Why does WP ignore the content of my taxonomy-portfolio.php? #186035moccaMemberI'm sorry, but I don't know what you mean. I want the system to generate automatically all terms without typing in them manually (which is not very practical if the client changes the terms in the future).
I guess that I have to create a solution like this:
'terms' => $terms,
And then probably something like:
$terms = get_the_terms( $post->ID, 'work');
But that's not enough. I need some further php.
May 21, 2016 at 8:26 am in reply to: Why does WP ignore the content of my taxonomy-portfolio.php? #186020moccaMemberOh, wow, cool!!!! Now it works!
This is the code, I use now:
$args = array( 'post_type' => 'portfolio', 'orderby' => 'menu_order', 'order' => 'ASC', // NEW: 'tax_query' => array( array( 'taxonomy' => 'work', 'field' => 'slug', 'terms' => array( 'logo', 'flyer', 'corporate design' ), ), ), );
One little question: what, if the client changes the taxonomy terms i.e. rename an existing one or add new ones? Does she always have to ask me to modify the template file? Is there a solution for this?
May 21, 2016 at 6:22 am in reply to: Why does WP ignore the content of my taxonomy-portfolio.php? #186013moccaMemberI’m a huge step further. Of course it was essential to give the file the correct name taxonomy-work.php (thanks for that hint).
Then I used this snippet to show which template file WP uses on a certain page:
function show_template() { if ( current_user_can( 'create_users' ) ) { global $template; print_r($template); } } add_action('wp_head', 'show_template');
If I use the wrong file name (i.e. taxonomy-portfolio.php) WP uses the index.php as the fallback template. So within Genesis’ standard loop there must be something my custom loop is lacking because the standard loop displays only the custom posts assigned to a certain taxonomy term i.e. “logo”. That’s what my taxonomy-work.php should do also.
Can anybody give me a hint what's wrong in my taxonomy-work.php (see code above “taxonomy-portfolio.php”)?
May 20, 2016 at 3:48 pm in reply to: Why does WP ignore the content of my taxonomy-portfolio.php? #185993moccaMemberI tried that also but that didn't work either. WP uses the content of the template (good!) but displays all custom posts within "Portfolio" not only those assigned to a specific taxonomy term i.e. "logo".
May 20, 2016 at 2:55 pm in reply to: Why does WP ignore the content of my taxonomy-portfolio.php? #185987moccaMemberThis is the code in the functions.php:
/* * Custom Post Type: Portfolio */ function post_type_portfolio() { register_post_type( 'portfolio', array( 'label' => __('Portfolio'), 'public' => true, 'show_ui' => true, 'query_var' => true, 'taxonomies' => array( 'work' ), 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'revisions'), ) ); } add_action('init', 'post_type_portfolio'); /** * Add custom taxonomies */ function add_custom_taxonomies() { // Add new "Work" taxonomy to Posts register_taxonomy('work', 'portfolio', array( 'hierarchical' => true, 'labels' => array( 'name' => _x( 'Work', 'taxonomy general name' ), 'singular_name' => _x( 'Work', 'taxonomy singular name' ), 'search_items' => __( 'Search Work' ), 'all_items' => __( 'All Work' ), 'parent_item' => __( 'Parent Work' ), 'parent_item_colon' => __( 'Parent Work:' ), 'edit_item' => __( 'Edit Work' ), 'update_item' => __( 'Update Work' ), 'add_new_item' => __( 'Add New Work' ), 'new_item_name' => __( 'New Work Name' ), 'menu_name' => __( 'Work' ), ), 'rewrite' => array( 'slug' => 'work', 'with_front' => false, 'hierarchical' => true ), )); } add_action( 'init', 'add_custom_taxonomies', 0 ); // Make archives.php Include Custom Post Types function add_custom_types( $query ) { if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $query->set( 'post_type', array( 'post', 'nav_menu_item', 'portfolio' )); return $query; } } add_filter( 'pre_get_posts', 'add_custom_types' );
April 6, 2016 at 1:49 pm in reply to: Get URL of the post image to use it as a background-image #183068moccaMemberOh, wow, thank you very much! I have to admit that I didn't think it would be this easy. Now everything works fine!
April 5, 2016 at 12:44 pm in reply to: Get URL of the post image to use it as a background-image #183006moccaMemberMmh, I don't know if I did it right (PHP newbie) but that didn't work.
The background image is loading but there're these error messages above: Screenshot
April 5, 2016 at 6:07 am in reply to: Get URL of the post image to use it as a background-image #182985moccaMemberEdit: the error message refers to: $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'full') );
moccaMemberI installed the Genesis Simple Breadcrumbs Plugin. But it doesn't offer this option.
moccaMemberThanks for your answer. No, that's not the correct plugin. I try to describe my question more precisely:
The breadcrumb plugin displays by default the title of a page. That's the text between the h1-Tag:
<h1 class="entry-title">Page Title</h1>
But I don't want the page title to be displayed in the breadcrumb menu but the menu item title of a page. They could be different. Here an example: title of the menu item = "about" and page title = "about me an my services".
By default the breadcrumb navigation would display "about me and my services". But I want it to display the "about" which is the text between the li.menu-item tag:
<ul id="menu-primary-navigation" class="menu genesis-nav-menu menu-primary responsive-menu"> <li class="menu-item ..."><a href="">title of the menu item</a></li> ... </ul>
-
AuthorPosts