obidos
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom meta box on specific pagesHi Phil and thank you for your reply.
I am adding my custom meta within my functions file and here is the bit of code I have to add it to the pages:-
function add_custom_meta() { add_meta_box("subpages", "Include page in sub navigation", "get_pages_list", "page", "normal", "default"); } add_action('add_meta_boxes', 'add_custom_meta');So it shows on all pages. I just need it on the top level parent pages.
Thanks
Forum: Plugins
In reply to: Plugin now workingSolved! No idea how really but I just activated the default theme to test and it worked. I then reactivated my custom theme and the plugin started to work again!
Forum: Themes and Templates
In reply to: Saving metabox select arraysI have worked out how to save the data in an array like so:-
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } else { $boxes = implode(",", $_POST['os_linkto_product']); update_post_meta($post_id, "os_linkto_product", $boxes); }No I need to be able to show the list with the selected items highlighted. Any ideas?
I have the id’s of the product name saved as a meta key called os_linkto_product and the meta values 49,61,51.
So I need the products relating to id 49,61,51 highlighted in the list.
Any ideas?
Thank you
Forum: Plugins
In reply to: Jquery FancyboxPlugin not working either.
I have jquery installed and only other code linked in is the jquery.isotope plugin.
I’m lost.
Forum: Plugins
In reply to: Jquery FancyboxHello,
I don’t really want to install plugins and I have not had any trouble using lightbox scripts before.
Will it not work unless you use a plugin?
Thanks,
Forum: Hacks
In reply to: Call ID of page you are on in functions.phpHmm ok so I have the paged loop set and working to call my posts for my custom post types. This is how it looks:-
<?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=4'.'post_type=tourist'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <article> <?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumbnail'); } ?> <div class="textblock"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p class="date"><?php the_date('jS F Y'); ?></p> <ul> <li><a class="facebook " href="http://www.facebook.com/sharer.php?u=<?php echo get_permalink($post->ID); ?>&t=<?php echo the_title(); ?>" target="_blank">Like</a></li> <li><a class="twitter" href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>">Tweet</a></li> </ul> <?php echo truncate(get_the_content(), 345); ?> <a href="<?php the_permalink(); ?>">Read full post...</a> </div> </article> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div> </div> <?php $wp_query = null; $wp_query = $temp;?>I am new to AJAX so stuggling to know what to do next.
Any advice or instruction on how to turn this in to a lazy loading with my jquery above?
Forum: Hacks
In reply to: Call ID of page you are on in functions.phpThank you so much for your help. Not had much chance to look until today but going to figure it out.
Forum: Hacks
In reply to: Call ID of page you are on in functions.phpHi there,
Thank you for your help. I am looking in to a solution as you said.
Here is my jquery that calls the AJAX:-
/* LOAD POSTS -------------------------------- */ var curr = MyAjax.perpage; $('.more').click(function() { $('.more span').addClass('hidden').next().removeClass('hidden'); $.ajax( { url: MyAjax.ajaxurl, dataType: 'json', data: 'action=load_more&offset='+curr, type: 'POST', success: function(data) { curr+= parseFloat(data.perpage); $('.more').before( data.html ); $('article:nth-child(5n+5)').addClass('remove'); if ( data.more == false ) { $('.more').remove(); } curr += data.perpage; $('.more img').addClass('hidden').prev().removeClass('hidden'); } }); return false; });Forum: Hacks
In reply to: Call ID of page you are on in functions.phpHi there,
It’s PHP and it’s in functions.php. Basically I have created an AJAX call to do lazy loading for more posts.
Here is the full function which is triggered by a button on the front end and activated with jquery.
function load_more_callback() { global $wpdb;// Allow direct access to db // Get 'posts_per_page' from WP options $perpage = get_option( 'posts_per_page', 4 ); // Check what page we are on for AJAX call $postname = ''; //$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; $slug = basename(get_permalink()); if ( $slug == 'boutiques' ) { $postname = 'boutiques'; } elseif ( $slug == 'tourist' ) { $postname = 'tourist'; } else { $postname = 'post'; } $numposts = number_format( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = '.$postname.'") ); // Set default JSON vars $data['response'] = FALSE; $data['html'] = ''; $data['perpage'] = $perpage; $data['more'] = TRUE; // Retrieve posts (starting from requested offset) $args = array( 'post_type' => $postname, 'numberposts' => get_option( 'posts_per_page', 4 ), 'offset' => $_POST['offset'] ); $posts = get_posts( $args ); // If we have found posts to return if ( count( $posts ) > 0 ) { // Loop through posts to create html foreach( $posts as $p ) { setup_postdata( $p ); $desc = truncate(get_the_content(), 345); $imgset = get_the_post_thumbnail( $p->ID, 'thumbnail'); $data['html'].= '<article class="'.$p->ID.'">'.$imgset.' <div class="textblock"> <h2><a href="'.get_permalink( $p->ID ).'">'.get_the_title( $p->ID ).'</a></h2> <p class="date">'.get_the_time( 'jS F Y', $p->ID ).'</p> <p>'.$desc.'</p> <a href="'.get_permalink( $p->ID ).'">Read full post...</a> </div> </article>'; } $data['response'] = TRUE; } // If we have loaded all available posts, tell theme to remove more button if ( ( $_POST['offset'] + $perpage ) >= $numposts ) { $data['more'] = FALSE; } echo json_encode($data); die(); // this is required to return a proper result }Forum: Fixing WordPress
In reply to: IIS and PermalinksHello and thank you for your speedy reply.
I see I need to change the web.config file. Where is that in the server files? I have checked the root and the includes folder but cannot see it.
Thanks
Forum: Plugins
In reply to: Shopp Plugin HelpThe code that calls the images and fancybox for the main image is:-
<?php shopp('product','gallery', 'p.width=300&p.height=450&rowthumbs=5&thumbheight=66&thumbwidth=45&zoomfx=fancybox&p.quality=90'); ?>If that helps?
Forum: Themes and Templates
In reply to: .htaccess fileHello,
I have created a 404 page within my theme and still getting some off results.
If I turn permalinks off and then on again it will show only the footer code.
I keep testing it and then I just get The connection was reset! My site works so it’s not a server error.
Any ideas? Is my host causing these issues?
I have created a wordpress 404 page for a custom theme on another server and that works. So I know I’m doing it correctly.
Forum: Fixing WordPress
In reply to: Custom post types and p tagsSolved after searching the forums.
It was not the way I created my custom post it was the way I was calling the information to display on the page.
Here is what I had to do:-
$content = apply_filters("the_content",$post->post_content);Hope it helps someone else.
Forum: Fixing WordPress
In reply to: Custom post types and p tagsHi there,
I have the site running local at the moment but here is my functions.php file that creates the custom post type I’m talking about:
<?php // CUSTOM POST TYPES // add_action('init', 'feature_init'); function feature_init() { //Default arguments $args = array ( 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => NULL, ); $labels = array ( 'name' => 'doctors', 'singular_name' => 'Doctor', 'add_new' => _x('Add New', 'Doctor'), 'add_new_item' => 'Add New Doctor', 'edit_item' > 'Edit Doctor', 'new_item' => 'New Doctor', 'view_item' => 'View Doctors', 'search_items' => 'Search Doctors', 'not_found' => 'No Doctors found', 'not_found_in_trash' => 'No Doctors found in Trash', 'parent_item_colon' => '', 'menu_name' => 'Doctors' ); $args['labels'] = $labels; $args['supports'] = array('title','editor','thumbnail'); $args['rewrite'] = array('slug' => 'Doctors'); $args['menu_icon'] = get_bloginfo('template_directory').'/custom/img/members.png'; $args['show_in_menu'] = true; register_post_type('doctors', $args); } add_action('add_meta_boxes', 'add_dermaskin_meta'); function add_dermaskin_meta() { add_meta_box("doctors", "Add Qualification", "add_about_meta", "doctors", "normal", "default"); } function add_about_meta($post, $metabox) { global $post; $qualification = ''; $custom = get_post_custom($post->ID); if (array_key_exists('qualification', $custom)) { $qualification = $custom["qualification"][0]; } include(MY_THEME_FOLDER . '/custom/about.php'); } // Save data add_action('save_post', 'save_custom', 10, 1); function save_custom($post_id) { if ( isset( $_POST['post_type'] ) ) { // About us qualifications if ( $_POST['post_type'] == 'doctors' ) { if (isset($_POST['qualification'])) { update_post_meta($post_id, "qualification", $_POST["qualification"]); } } } } ?>Forum: Fixing WordPress
In reply to: List categories and posts per categoryGlad you have learned too deepbevel!
I have learned a lot about custom taxonomies etc recently. Going to look in to the code more and get my head around it :).
Thank you to The Sweeper and Deepbevel for all your help.