Create simple columned archive page

The best way is to make a SQL query to the database and get the results like the wp_get_archives() does but now you can manipulate the results as you wish. In your case I would do something like this I added some comments to help you understand the process. function get_archives_lists() { global $wpdb, $wp_locale; … Read more

How to get a count of all posts in foreach loop and split into fourths

I had a similar problem couple years ago. Here’s a gist I’ve published, which shows the basic idea how I solved the problem,https://gist.github.com/koskinenaa/4d8461116885c0e64d5ca167ae53434d Applying the gist to your situation I think the solution could be something like this. I didn’t test this so it might require some tweaking, but it should at least point you … Read more

Getting post attchment URL to populate a CPT Admin Page Column

The File field’s documentation has some options you can try, but here’s an example if your field’s Return Value is array, where you can use $gradingForm[‘url’] to get the attachment URL: $gradingForm = get_field( ‘grading_form’, $post_id ); echo $gradingForm ? ‘<a href=”‘ . esc_url( $gradingForm[‘url’] ) . ‘”>Grading Form</a>’ : ‘N/A’; And the proper way … Read more

CPT Columns doesn’t show categories

why ‘categorias_de_pessoas’ => __( ‘Categorias’ ), doesn’t the show the content within the categories selected to my post? This is a taxonomy called ‘categorias_de_pessoas’. That issue happened because you did not prepend the taxonomy (or array key or column name) with a taxonomy-. I.e. The correct format is: taxonomy-<taxonomy>. See WP_Posts_List_Table::column_default(). So to fix the … Read more

Custom Columns WordPress Admin

first create the new column: add_filter( ‘manage_edit-post_columns’, ‘c3m_new_column’); function c3m_new_column( $defaults ) { $dfaults[‘post_thumbnail’] = ‘Post Thumbnail’; return $defaults; } Now the function to output the thumbnails in the column: add_action( ‘manage_posts_custom_column’, ‘c3m_custom_column’, 10, 2); function c3m_custom_column( $column_name, $post_id ) { if ($column_name == ‘post_thumbnail’) { if ( has_post_thumbnail() ) { $img_url = wp_get_attachment_image_src( get_post_thumbnail_id() … Read more

Split function “the_tags” in 2 columns

Use get_the_tags instead of the_tags to grab an array of tags, and array_chunk to split it. You will then need to build a loop to display the tags. $tags = get_the_tags(); if (!empty($tags)) { $tags = array_chunk($tags,ceil(count($tags)/2),true); foreach($tags as $v) { echo ‘<ul>’; foreach ($v as $tag) { echo ‘<li><a href=”‘.get_tag_link($tag->term_id).'”>’ . $tag->name . ‘</a></li>’; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)