php – WordPress – display relationship between blog posts and custom posts

I created through ACF a relationship between blog posts and the custom post type, which contains employee profiles. Through the relationship, I am able to display links to the employee’s profile, who is the author of a post.

I want to display now the list of posts created by employees at their profiles. I was able to find a code which does that. Unfortunately, whenever I assign more than 5 blog posts to an employee, the next ones are not visible. Would you be able to help me and tweak the code to display more than 5 posts in new rows?

<div class="author-content">

        <?php 
        /*
         *  Query posts for a relationship value.
         *  This method uses the meta_query LIKE to match the string "123" to the database value a:1:{i:0;s:3:"123";} (serialized array)
         */

         $documents = get_posts(array(
                     'post_type' => 'post',
                     'meta_query' => array(
                      array(
                            'key' => 'our_people_author', // name of custom field
                            'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
                            'compare' => 'LIKE'
                                )
                            )
                        ));

                        ?>
        <?php if( $documents ): ?>

          <ul class="table-author">
             <?php foreach( $documents as $document ): ?>
<li class="singleauth-list">
<a href="<?php echo get_permalink( $document->ID ); ?>"><img src="https://wordpress.stackexchange.com/<?php echo get_the_post_thumbnail_url($document->ID,"thumbnail');?>" class="people-post-image"></a>
                   <a href="<?php echo get_permalink( $document->ID ); ?>" class="author-links">
                     <?php echo get_the_title( $document->ID ); ?>
                   </a>
</li>
             <?php endforeach; ?>
         </ul>
      <?php endif; ?>
</div>

Display category filters for custom post type when category is shared by multiple post types

I already have a solution to this problem but I’m wondering if there’s a more efficient way to do it. I have a custom post type called “galleries” that uses the same taxonomy as blog posts. So if a user creates a category named “Animals” when making a blog post, that category will show up as an option when creating a new gallery.

On the gallery display page, I want to output a list of categories in a select element which are used to filter the galleries. However, if no galleries are using the category “Animals”, that category shouldn’t be displayed, since selecting it will return no results.

Here’s how I solved this so far:

<?php
  // 1. Get all the categories
  $categories = get_categories( array(
     'orderby'   => 'name',
     'order'     => 'ASC'
  ) );
?>

<select>

<?php
// 2. Loop through the categories
foreach($categories as $cat) {

  // 3. Get the ID of the current category
  $category_id= get_cat_id($cat->name);

  // 4. Query the galleries post type for posts using the current category
  $args = array(
    'post_type' => 'galleries',
    'category' => $category_id
   );
  $posts = get_posts($args);

   // 5. Count the number of posts using the current category
   $count = count($posts);

   // 6. Display the option if that number is greater than 0
   if($count > 0) { ?>

     <option value="<?php echo $cat->slug; ?>"><?php echo $cat->name; ?></option>

   <?php } ?>

</select>

It seems like that’s a lot of steps and maybe I’m doing this in a roundabout kind of way. Is there a more efficient way to do this? Thanks in advance.

hdmi – External display switches to lower resolution and I need to restart my MacBook to fix it

My setup is the following:

  • macOS Catalina, version 10.15.7 (but this has been happening since before Catalina)
  • MacBook Pro (15-inch 2019)
  • AOC Q27P1 External display, connected via this USB C to HDMI cable

Display will work fine for some time, then it suddenly goes black for a couple of seconds and when it comes back on, it switches to a lower resolution for a seemingly random reason.

Here’s the Displays settings when the bug happens:

enter image description here

And here’s what I see after I restart the MacBook:

enter image description here

As you can see, the highest two resolutions disappear until I restart the MacBook. Where do you think could be the problem?

automation – How can I automatically display the section link on my one-page Elementor website?

My website is using long one-page posts for each issue of our magazine and these are navigated through anchor links. I add the anchor links through Elementor. I want to be able to display the section link automatically so people can share that part of the page easily.

For example, here, the section link for the article on naps is https://theyellipages.in/#silent . How can I display this automatically so I don’t have to manually do it for each section since there are many in a page?

magento2 – shipping charge display in cart without shipping address detail in magento 2

I am using magento 2.3.4, and trying to show shipping charges in cart page, without enter the shipping detail. it should be only based on grand total of cart.
for that i found some blog but not helped.

condition like :

price 50 <= 300

price 0 >=300

How should i implement this condition either by any config setting or programattically?

20.04 – External Display screws up stylus pen cursor position

I’m working on a HP Envy X360 Ryzen Laptop(13-ag0xxx ) Ubuntu 20.04.
When I add an external (non-touch) screen to the laptop, the location of the HP pen on the laptop-screen is not correct anymore. As soon as I add the external screen on top of the laptop screen, the location of the pen is still good on the lowest point of my notebook screen, but the more I go upward on the touchscreen of my notebook, the worse the position of the cursor on the screen becomes. The cursor then even switches to the external screen, though I am still only touching the notebook screen.

This is the same problem as in post askubuntu.com/questions/1146029/, but the solution
‘Toggle on/off Display for TV’ did not help unfortunately…

Help on this is very appreciated! Switching from Windows to Ubuntu this is my last unsolved problem…

xinput –list-props (of Pen):
‘ELAN0732:00 04F3:262B Pen (0)’:
Device Enabled (147): 1
Coordinate Transformation Matrix (149): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Node (272): “/dev/input/event17”
Device Product ID (273): 1267, 9771
libinput Tablet Tool Pressurecurve (579): 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000, 1.000000

Add Filter in REST Export display in view in D8

I have a view “Nearest Dealers” that lists all the near dealers. There are two displays – Page & REST Export. I’ve added a filter(exposed to visitors) that lets customer search dealers based on current location and distance(eg: 10km radius). Filter works perfectly, but I want to show the same filtered results in REST Export display for the same view. Is it possible to do so because I have no clue how to make this work. Or is there any way to add the same filter for the REST Export display ?

Search Result displays Item_default as display template for my custom result type

My Search Results displays Item_default as display template for my custom result type . I have my display template major version published and have mapped in Search Result Types. My search result type is also under site collection. In content search web part I have set result type to decide option.

I don’t know where else to look to debug the issue. Any pointers ?

8 – How to display default drupal search block in twig template

In twig_tweak module before version 2 (for Drupal 8) I could place the following code in my page twig template and it would work:

{{ drupal_block('exposedformsearch_contentpage_1') }}

This would display put the default site search box.

After upgrading to version 2, this doesn’t work anymore and see the following message on the page:

This block is broken or missing. You may be missing content or you might need to enable the original module. 

I tried using the command:

{{ drupal_block('search_form_block') }}

That displays the same error message.

Does anyone know what the the correct call is? I can’t seem to find any documentation anywhere as to what the replacement call should be.

Thanks.

display – Keynote uses my 3 monitors, how can I get one back?

I am using Keynote (10.2, latest for now) for presentations. I love to have one monitor for displaying the content, one for displaying the notes, and have one free for chats, monitoring Q&A when on a webinar, and other apps. PowerPoint does that (migration to PowerPoint is not an option at this time).

When I start a presentation, Keynote takes control of the 3 screens. By default, one was just for the notes, but I re-designed the presenter mode, but now my third screen is a black screen. Is there a way to claim it back, or tell Keynote that there are only two monitors for it to access?