Tag Info

Hot answers tagged

2

All you need is to enable permalinks. I strongly recommend switching to permalinks: /%postname%/ The old links will still work. (In fact, every single permalink type is just an alias for the default one: ?p=%post_id% ). Being able to give people easier to remember links to pages is a secondary reason. The main one should be boosting page rankings in ...


2

Your problem is in this section foreach( $voc_pages as $voc_page ) { $voc_link = '<a href="'.get_page_link( $voc_page->ID ).'">'.$voc_page->post_title.'</a>'; return $voc_link; } You return $voc_link after just the first iteration, stopping the function and returning its value. You should take return $voc_link; outside your ...


1

If you tried to create a static file and then load it like a normal file, you may have had trouble because a WP page as we call it, is actually not actually 1 file, but rather a lot of files that tell Wordpress how to put together information queried from the database based on the query that is used in the URL. Most modern WP installs use pretty-links which ...


1

If you want the theme to be independent from the CPT's, place the CPT's as plugin(s). If the CPTs go with the theme, functions.php sounds like the perfect spot for them. If you add them as plugins, you should group them in one or more plugins depending on functionality, not on post type.


1

Looking at the WP_Style class, we find the style_loader_tag filter, that might be useful. Try for example: add_filter( 'style_loader_tag', function( $link, $handle ) { if( 'google-fonts' === $handle ) { $link = str_replace( '/>', ' data-noprefix />', $link ); } return $link; }, 10, 2 );


1

It's probably Firefox prefetching pages, which it can do based on the rel attribute of links (see http://stackoverflow.com/a/18156967/664741). You could alter these links to remove eg rel="next", or you could detect Firefox prefetching by checking the headers sent: if ( ! isset( $_SERVER['HTTP_X_MOZ'] ) || $_SERVER['HTTP_X_MOZ'] != 'prefetch' ) { ...


1

In your wp_query loop you'll want to check the page template of the current post object. You'll be able to set that to a string and use it however you want Close to this: while ( $query->have_posts() ) : $query->the_post(); if (is_page) { $pageTemplate = get_page_template(); echo "<p class=\"" . $pageTemplate . "\">" . get_the_title() . ...



Only top voted, non community-wiki answers of a minimum length are eligible