Forum Replies Created

Viewing 15 replies - 31 through 45 (of 855 total)
  • Thread Starter David Gard

    (@duck_boy)

    Thanks for the heads up.

    I found out that removing the post_type from the query got it working in the interim (and really post_type shouldn’t matter in most Posts2Posts queries).

    I updated yesterday, so will try adding them back it.

    Thanks again for the great plugin.

    Thread Starter David Gard

    (@duck_boy)

    Ok, so the above code does through up an error –

    When checking user_can_access_admin_page(), because options.php is not a key in the global $admin_page_hooks, the page type is set wrongly as admin, not settings. This causes WP to tell me that I do not have permission to edit the page, when I clearly do.

    I’d ideally not like to go down the CSS route, but I will look in to that for now.

    If anyone has any other suggestions, I’d be greatful.

    Thanks.

    Thread Starter David Gard

    (@duck_boy)

    Nevermind, as is oftern the way, I stumbled across the answer as soon as I stopped looking!

    Thanks for the suggestion though Esmi.

    $this->pagehook = add_submenu_page(
        'options.php',
        __('Edit Chart'),
        __('Edit Chart'),
        'edit_charts',
        'edit-single-chart',
        array(&$this, 'on_show_page')
    );

    Explained in the second example in the codex for add_submenu_page().

    Thread Starter David Gard

    (@duck_boy)

    I’ll be honest, I can’t remember exactly what was going on with the above as it was so long ago, but I think it was to do with a probelme with how I was creating the date to add to the feed.

    Here is the code that I use (and that works) on my site now.

    The global $post; call allows me to get $post->ID just fine.

    /**
     * Adds the 'event_date' meta value to a feed
     */
    add_action('atom_entry', 'add_event_date_to_feed');
    add_action('rdf_item', 'add_event_date_to_feed');
    add_action('rss_item', 'add_event_date_to_feed');
    add_action('rss2_item', 'add_event_date_to_feed');
    function add_event_date_to_feed(){
    
    	global $post;
    
    	$event_date_raw = get_post_meta($post->ID, 'event_date', true);
    	if($event_date_raw && $event_date_raw !== '') :
    		$date_object = DateTime::createFromFormat('d/m/Y', $event_date_raw);
    		$event_date = $date_object->format('D, d M Y 23:59:59 O');
    	else :
    		$event_date = '';
    	endif;
    
    	printf("\t\t".'<eventDate>%1$s</eventDate>'."\n", $event_date);
    
    }

    If you are still having problems, post some code and I’ll try to help.

    The issue is because you copied a file, including all of it’s functions. So now, PHP is finding two functions with the same name, and it is causing an error.

    To fix, you need to connect to your site via FTP (your hosts can help you with this, if you have no FTP access already) and remove the copied file, meaning there is only one instance of each function again.

    To make a function pluggable (so that it is only included if it does not already exist) you need to wrap the function as follows –

    if(!function_exists('my_function')) :
    
        function my_function(){
    
            // Blah, blah, blah...
    
        }
    
    endif;

    EDIT

    I’ve just re-read your post and saw that it is about a Child Theme. To ensure that your Child Theme references the correct files, make sure that you include the template name style.css file for the Child Theme

    'Template: twentytwelve'

    And yes to adding 'paged' => get_query_var('paged');.

    I take it also that you only expect 1 more post to be displayed when you click on ‘Older’/’Newer’? Usueally this scenario is used for an Index page, where multiple Posts are listed.

    Can you please (as per forum rules) put the code in to a Pastebin? It makes it difficult to read posts if you place big chucks of code in them.

    That said, you code looks a little off. For next_posts_link() and previous_posts_link() to work, you need to have run query_posts, not get_posts(). Basically, WP doesn’t know what posts to look at for next/previous, becuase there is nothing in the $wp_query global for it to check.

    Have a read of these and it should set you on the right path –

    What Permalink structure are you using, and have you tried resaving the Permalink structure?

    If yes to the above, have you checked to ensure that you have write access to .htaccess?

    What code are you using?

    Total guess without seeing it, but are you passing the paged argument to the query?

    The only way that you can get your FTP credentials is by going to your host. Depending on who it is, it may be that you have one username and password for everything (accessing MySQL, FTP, domain management, etc.), but some of the more advanced ones require you to set up accounts for the various different functionalities.

    Hey Bhan, welcome to the forums.

    Don’t worry about your questions – no question is basic if you don’t know the answer, and we all had to start somewhere. My only advice would be to give us some more information – as much as you possibly can – so that we can best help you.

    1 – A template and a plugin are two seperate things. How exactly are you trying to install the theme? Is it through the WP admin, or have you downloaded it to install it manually? For the later, you need to have access to your website via FTP, which is something your hosts can help you with – once that access is sorted, tell us on here and someone will tell you what to do.

    2 – Short of actual realworld experience, it’s difficult to tell compatibility of plugins. The best was is to simply activate them both and see what happens. The docs for the plugins should tell you how to use them. If there is an error, you can simply deactivate the plugin.

    Hope that helps.

    Forum: Fixing WordPress
    In reply to: Custom taxonomy

    Good news.

    Forum: Fixing WordPress
    In reply to: Custom taxonomy

    Ok, first off, that’s make in in to one piece of code – they don’t specifiacally have to be seperate, and I find this easier (of course feel free to amend as you see fit). Pastbin

    Next, we’ll get rid of the return $sector; line at the very bottom – I don’t know why I put that there, it serves no purpose.

    Finally, I notice an error in the code (that came from me). At the end of each <select>, we should be closing it, but we are instead adding another open tag. The lines are directly before echo $dropdown;, and both should be $dropdown.= '</select>'."\n\n";.

    Forum: Fixing WordPress
    In reply to: Custom taxonomy

    I have only ever used it for one taxonomy term dropdown on a post edit screen, so chances are you just need to edit it slightly to differentiate between the two.

    First thing I’d check is the name attribute on the <select>, to ensure that they are unique. I’d then check to make sure I was definatley saving to the correct taxonomies (near the bottom), not using the same on on both.

    No problem.

Viewing 15 replies - 31 through 45 (of 855 total)