Tag Info

New answers tagged

0

Why don't you add a custom body class to the page template which you can hard code into the template or add conditionally from your functions.php file like this: //* Add custom body class to the head add_filter( 'body_class', 'wpsites_body_class' ); function wpsites_body_class( $classes ) { if ( is_page_template('template-x.php') ) $classes[] = ...


0

If you're not going to use a ad generation service (which there are many - use them googles) and are going to add them yourself, a Custom Post Type would probably be your best bet. You can then use WP_Query, get the number of ads you want to display on a page, and you can even randomize them via order(rand). If you want to actually rotate them you're going ...


1

One way is to have a single front-page.php and then using get_template_part(), to show different content based on user choice. Rough code: get_header(); $layout = get_option( 'front_page_layout', 'default' ); get_template_part( 'front-page', $layout ); get_footer(); After that you need to create a file for every layout, they should be called, something ...


0

There is only one option, the page templates one. This is how 99% of the themes work and what wordpress users and implementators are used to. You can try to be unique but no one will appreciate it.


1

According to the Codex, your custom page template must have a header containing the name of the template. All page templates must be named in this way, or they will not appear in the "Template" dropdown. Here's an example, make sure your custom template has a header in this format: <?php /* Template Name: My Custom Page */ // Your custom page template ...


2

May be something is wrong on your page template file. Have your added page template name at top of the page like this: <?php /* Template Name: My Custom Page */ Try with this and check once again. You can check WordPress document for creating custom page template. Check this link: Page Templates


0

Thanks to Bigsmoke it is possible to play with wpautop : A - Enabling or disabling wpautop on selected pages B - Without modifying function.php C - Without messing around old pages if Wpautop filter was removed D - Without squaching the content in the text side of the editor http://wordpress.org/plugins/wpautop-control/ Now i can make most of my text ...


0

You can set the display status with show_admin_bar function <?php show_admin_bar( false ); ?>


0

It is kind of hackish but I found adding the below snippet inline just like WordPress core did the trick. I hate inline styles but life doesn't always produce lemonade :-S /** * Hides the admin bar on a template page. */ function hide_admin_bar() { wp_add_inline_style('admin-bar', '<style> html { margin-top: 0 !important; } </style>'); ...


1

You could just include it in your functions.php: if ( ! is_admin() ) { include ABSPATH . 'wp-admin/includes/template.php'; }


2

You can try the the_content filter, to append/prepend text to the post content. Here's a simple example: add_filter( 'the_content', function( $content ) { if( is_single() && has_tag( 'follow-me-on-twitter' ) ) { $content .= '<div>Like my posts? Follow me on twitter!</div>'; } return $content; }, 99 ); where ...


0

What is referred to as a "template part" seems to fit exactly your need here. WP Template Part ref Simply write up the snippet that produces the message you would like to repeat in a php file and call it with <?php get_template_part( $slug, $name ); ?>


3

Your terminology is a bit scrambled here. A custom taxonomy is a taxonomy which you manually register through register_taxonomy. In your case that is ait-dir-item-category. Any "category" (as you call it) you create in your custom taxonomy is called a term. In this case events. To create a custom page for events, you need to name your template ...


0

Thanks for the solution, Bainternet. It was pulling in multiple posts from the default post type as RodeoRamsay reported, so I got it to work with my custom post type like so: <?php define('WP_USE_THEMES', false); //echo "<h1>printer friendly version:</h1>\n"; setup_postdata($_GET['pid']); while ( have_posts() ) : the_post(); ...


1

As Pages are a special built in Posttype, they get an own template hierarchy. Other "normal" post types and custom post types can only be templated by "single-$posttype.php". You can however hook into the single_template filter and make wordpress redirect to your template file: function get_custom_post_type_template($single_template) { global $post; ...


0

PHP (unlike HTML) is not meant to be used as content markup language. It is server–side language with too much access. It is very challenging to safely and securely treat PHP as part of content. For basic example — what if one of your authors writes PHP code in a post which amounts to "make me site's administrator"? While WP plugins implementing this do ...



Top 50 recent answers are included