nessler
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Add navigation links on post dashboard for current author onlyOk, that works but only gets me halfway.
It does reproduce the previous and next links, however it does this for the entire post table.
After some digging in the code I think I can alter this bit of code, however I can’t find a working example anywhere, to keep this to “in_author”.
Is it possible to alter the
get_previous_post()
to restrict it to current author ? All I can find is a $taxonmy I can add which relates only to category.add_action('admin_print_footer_scripts','amm_edit_next_prev_post_button'); function amm_edit_next_prev_post_button(){ $screen = get_current_screen(); //echo "<pre>"; //print_r($screen); $supported_types = array('page', 'post'); if( strpos($screen->parent_file, 'edit.php') !== FALSE && in_array($screen->id, $supported_types) && in_array($screen->post_type, $supported_types) && $screen->action != 'add'){ //Prev-Next are arranged acc. to post table so switched next to prev and prev to next $next_post = get_previous_post(); $previous_post = get_next_post(); ?>
Forum: Fixing WordPress
In reply to: Add navigation links on post dashboard for current author onlyin the back end, where you write your post, thus in the backend, where you write title and content. NOT in the oversight with all the posts. the editor wants to adjust something in one post, click on a link to go to the next and remain in the post edit screen.
Forum: Fixing WordPress
In reply to: Add navigation links on post dashboard for current author onlyin the backend, where the post is edited.
Underneath the post content our editor requested to have the option built in to be able to navigate to the previous or following post, simply to not have to return to the index of posts.Forum: Developing with WordPress
In reply to: Category change after set timesadly no success either.
I came up with another solution which does work, though I still need to make it category specific so that it only fires on the “film nu in de zaal” category, as it is now all articles will be moved.
// runs when a post is published add_action( 'publish_post', 'schedule_post_check' ); function schedule_post_check( $post_id ) { // Schedule the event wp_schedule_single_event( time() + 660, 'check_post', array( $post_id ) ); } // a custom hook to schedule add_action( 'check_post', 'check_post_cats', 10, 1 ); // replace post categories function check_post_cats( $post_id ) { // An array of IDs of categories we want this post to have. $cat_ids = array( 12 ); $term_taxonomy_ids = wp_set_object_terms( $post_id, $cat_ids, 'category' ); if ( is_wp_error( $term_taxonomy_ids ) ) { // There was an error somewhere and the terms couldn't be set. } else { // Success! The post's categories were set. } }
Forum: Developing with WordPress
In reply to: Category change after set timeadjusted the code as you suggested above, but still no category is added.
Something changed though, instead of “uncategorized” there is now a dash “—”.Full code as I have it now:
// runs when a post is published add_action( 'publish_post', 'schedule_post_check' ); function schedule_post_check( $post_id ) { // Schedule the event wp_schedule_single_event( time() + 660, 'check_post', array( $post_id ) ); } // a custom hook to schedule add_action( 'check_post', 'check_post_cats', 10, 1 ); // replace post categories function check_post_cats( $post_id ) { //categories $old_cat = get_cat_ID( 'film-nu-in-de-zaal' ); $new_cat = get_cat_ID( 'film-recensies' ); // check for the old category if ( has_category( $old_cat, $post_id ) ) { wp_set_post_terms( $post_id, array( $new_cat ), 'category', false ); } } ?>
Forum: Developing with WordPress
In reply to: Category change after set time$old_cat = get_cat_ID( ‘film-nu-in-de-zaal’ ); should return 39
$new_cat = get_cat_ID( ‘film-recensies’ ); should return 12I’ll try the set post terms later when I get home and let you know if that worked.
YOU’RE A LIFESAVER !!!!
the print r function revealed this
” [0] => Ancienne Belgique, Brussel ”I found it odd to be just simply [0], but sure enough after inserting this into the code the span class AND additional comma appeared like magic.
After literally spending 2 days cracking this nut I can’t thank you enough.
If anybody else ever comes across this problem, this was my final solution
<span class="td-author-date"> <?php if( $author_photo != '' ) { echo $this->get_author_photo(); } ?> <?php echo $this->get_author();?> <?php echo $this->get_date();?> <?php $concertlocatie = get_field( "concertlocatie" , $this->post->ID ); //etc...?> <?php if ( $concertlocatie ) : ?><span class="metacelocation"><?php echo $concertlocatie['0']; ?></span><?php endif; ?> <?php echo $this->get_comments();?> </span>
If I use get field, the comma appears where it should including the span class, but sadly the value of the field “concertlocatie” changes into “ARRAY”, which was the main reason I used the_field.
This can be seen under the foto of Grate Van Fleet here: https://v2.enola.be/
I adjusted it like that, but sadly to no avail, the span class metacelocation is still not showing. Very odd
Forum: Developing with WordPress
In reply to: To not show a custom field if emptythat worked even better than a magic trick, thanks a lot !
Thanks for the info.
The theme we bought and are customizing is quite complex to put it mildly.The page where we are currently developing is this “taxonomy-alphabetical_letter-a.php”, which is the parent letter in the taxonomy alphabetical letter, so yes technically not child taxonomies but terms.
Would it be a correct way to proceed as follows:
Create child terms for the taxonomy “alphabetical letter’ pages for all the letters,
-A (id 441, 500 posts)
-musicreviews-a (no posts)
-livereviews-a (no posts)
-…..
-B (id 442, 400 posts)
-musicreviews-a (no posts)
-livereviews-a (no posts)
-…..then create custom taxonomy pages like so:
“taxonomy-alphabetical_letter-a-musicreviews-a.php”
“taxonomy-alphabetical_letter-a-livereviews-b.php”
…and then try to adjust the loop accordingly per your instructions ?
If you’d be so kind to point us in the right direction with the code below (if this is where the fix would be) we’d be on our way to try and overcome this issue.The current alternative I’m following through is creating custom archive pages which seems like a lot of work since I’m guessing this should be a fairly easy fix…
the loop we are currently using looks like this,
$args = array( 'post_type' => 'post', 'posts_per_page' => '-1', 'meta_key' => 'keyword', 'orderby' => 'meta_value', 'order' => 'ASC', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'alphabetical_letter', 'field' => 'term_id', 'terms' => array( '441' ), //this is by slug ), array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => array( 'musicreviews' ), //this is by id ), ), ); // The Query query_posts( $args ); // The Loop if (have_posts()) { while ( have_posts() ) : the_post(); echo $td_template_layout->layout_open_element(); if (class_exists($td_module_class)) { $td_mod = new $td_module_class($post); echo $td_mod->render(); } else { td_util::error(__FILE__, 'Missing module: ' . $td_module_class); } echo $td_template_layout->layout_close_element(); $td_template_layout->layout_next(); endwhile; //end loop echo $td_template_layout->close_all_tags(); } else { /** * no posts to display. This function generates the __td('No posts to display'). * the text can be overwritten by the themplate using the global @see td_global::$custom_no_posts_message */ echo td_page_generator::no_posts(); }
thanks for your insights, Nick.
- This reply was modified 6 years, 10 months ago by nessler.
Forum: Fixing WordPress
In reply to: How can we run an update script on all past posts ?thanks for your input all. will be working my way through this, probably with a lot of trial and error but at least I know where to look now.
Forum: Plugins
In reply to: [FG Joomla to WordPress] Custom fields from joomla to wordpress…in the joomla sql database jos_content we have the columns
“director”, “scenarists”, “label”, “website”, “credits”, “score” to name a few.These columns are missing from the wp_posts.
I take it that is what you mean ?
Forum: Plugins
In reply to: [FG Joomla to WordPress] Importing won’t stopcurrently looking into that and seems to be working too.
however is it also possible to refer to the live web url to a folder on the hard drive ? for instance our site is https://www.enola.be, if we have a folder at c:\\www.enola.be with all the contents there would that work ?kind regards
and how ? I am having the exact same problem…