php – How can I exclude the latest post from the front page?

WP_Query‘s offset argument can be used to specify at what index you would like the results to begin at. We could leverage it to offset all of the query results when they’re ordered in reverse chronology, in effect omitting the most recent post.

However, the offset argument does not take into account pagination parameters (so you need to calculate the offset relative to the set of all posts the query would match rather than the current page). It’s presence in WP_Query arguments also overrides the page/paged pagination parameter.

You might also want to make sure that your changes only affect the main query in case any other queries are executed on the home page, and that you don’t affect queries in the dashboard as well.

 * Exclude the latest post from reverse-chronologically ordered queries on
 * the home page by offsetting by 1.
function wpse390749_home_exclude_latest_post( $query ) {
  if( ! $query->is_main() || ! $query->is_home() || is_admin() )

  $orderby = $query->get( 'order_by', 'date' );
  $order   = $query->get( 'order', 'DESC' );

  if( $orderby === 'date' && $order = 'DESC' ) {
    $offset  = $query->get( 'offset' );
    if( $offset === '' ) {
      $page           = $query->get( 'page', $query->get( 'paged', 1 ) );
      $posts_per_page = $query->get( 'posts_per_page', get_option( 'posts_per_page' ) );
      $offset         = ( $page - 1 ) * $posts_per_page;

    $query->set( 'offset', $offset + 1 ); // Overrides pagination parameters.


  // TODO: exclude latest post from queries in other orders...
add_action( 'pre_get_posts', 'wpse390749_home_exclude_latest_post' );

I don’t have a great solution for excluding the latest post from non-reverse-chronological queries at the moment, however.

.net core – dot net test exclude multiple projects

I have dot net task in yaml file as follows:

        - task: DotNetCoreCLI@2
          displayName: 'dotnet test ${{ }} function'
            command: test
            projects: 'Service/GroupMembershipManagement/Hosts/${{ }}/Services.Tests'
            arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)TestResultsCoverage${{ }} /p:Exclude="(A.*)*"'
          condition: and(succeeded(), eq(variables('BuildConfiguration'), 'debug'))

I need to exclude 2 projects A. and B. Ho do I update this?

magento2 – How to exclude certain SKU to be calculated in Minimum Order Amount

I’m currently using the native M2 Minimum Order Amount module.

I want to add to my store some products, but I don’t want them to be consider during minimum order amount calculation.

Minimum_Order_Amount = 30

If cart contains some SKU’s
Then Minimum_Order_Amount += itemRowSubtotal

I’m wondering how to approach this problem?
Also I would like to return dynamic error equivalent to change.

magento2 – Magento 2 | Exclude duplicate Item ID from a collection before foreach

When I foreach my collection filtered by tier price, qty and customer group I get the error: “Item (Magento Catalog Model Product Interceptor) with the same ID already exists”.

This is my class:

namespace VendorModuleBlock;
class ProductCollection extends MagentoFrameworkViewElementTemplate

protected $_productCollectionFactory;
    public function __construct(
        MagentoBackendBlockTemplateContext $context,        
        MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory,        
        array $data = ()
        $this->_productCollectionFactory = $productCollectionFactory;    
        parent::__construct($context, $data);

public function getProductCollectionSearch() {
        $collection = $this->_productCollectionFactory->create();

        $collection->getSelect()->join('catalog_product_index_price as price_index', 'e.entity_id = price_index.entity_id'); 
        $collection->getSelect()->join('catalog_product_entity_tier_price as tier', 'price_index.entity_id = tier.entity_id');

            ->where('tier.all_groups = 0')
            ->where('tier.qty = 1000')
            ->where('tier.value <= 0.20');

        return $collection;

This problem arises when I try to foreach product in my phtml file.
This is my phtml file:

$blockProductColl = $block->getLayout()->createBlock('VendorModuleBlockProductCollection');
$collectionSearch = $blockProductColl->getProductCollectionSearch();


//echo $collectionSearch->getSize();
foreach($collectionSearch as $itemSearch){
    echo $itemSearch->getSku().'<br/>';

Is there a way to exclude duplicate Item IDs before foreaching the collection?

8 – Exclude specific weekdays from date field

I am using a date field in the Commerce Order to pick up the product (Collection Date)enter image description here

Currently, there is a restriction to select dates in the past.
Is there an option on the date field, somehow to restrict specific days of the week?
For example, weekends (Saturdays and Sundays) should not be available.

What would be the best approach to solve this?

Ansible exclude semicolon – Server Fault

I’m new to ansible and right now I’m trying to search a specific word from my output:

      - vlan 999 


   - name: Check Vlans
      - '!all'
      - 'vlans'
     register: vlan_check
   - copy: content={{ vlan_check }} dest=/root/ansible/outputs/ios_test/{{ inventory_hostname }}.txt
   - name: Check output
     shell: 'grep -i "vlan_id"":" {{ vlans[0]}} /root/ansible/outputs/ios_test/{{ inventory_hostname }}.txt'
     register: output

   - name: Output msg
     debug: msg="'{{ vlans[0] }}'is on switch"
     when: output is changed

Every task is successful but I get this error when the task “Check output” is done:

fatal: [SWAnsible]: FAILED! => {“changed”: true, “cmd”: “grep -i “vlan_id””:” 999 /root/ansible/outputs/ios_test/SWAnsible.txt”, “delta”: “0:00:00.004479”, “end”: “2021-05-10 16:55:02.825909”, “msg”: “non-zero return code”, “rc”: 2, “start”: “2021-05-10 16:55:02.821430”, “stderr”: “grep: 999: No such file or directory”, “stderr_lines”: [“grep: 999: No such file or directory”], “stdout”: “”, “stdout_lines”: []}

I think the problem here is this piece of code here:

shell: 'grep -i "vlan_id"":" {{ vlans[0]}}

I could also just search for 999 but in my opinion this is not unique enough for this. I already tried different methods to exclude the semicolon but it changes the whole output from "vlan_id": 999 to "vlan_id"":" 999 and thats why the grep is not possbile.

How can I solve this? Thank you

exclude product from cart spend restrictions: yith-woocommerce

I’m using a minimum-maximum plugin for woocommerce from yith. say I have 3 categories of paper, pens, and mugs. paper generally costs $10, pens generally $5, and mugs generally $50.

now I set a cart spend minimum of $100 but I want to exclude pens from the cart spend minimum. even after setting it up in the backend, I still cannot checkout pens because it claims the cart spend of $100 has not been reached.

if anyone has experienced this and has a workaround, please help.