Custom Post Types – Hide some categories in wp_query

I have created a new custom post type. Now I want to show all posts on one page. But I would like to hide in a post of a category in it. How could I do that?

                                $args_post = array(
                                    'post_type' => 'products', 
                                    'posts_per_page' => -1,
                                    'post_status' => 'publish', 
                                    'orderby' => 'publish_date', 
                                    'order' => 'ASC',
                                    'tax_query' => array(array( 
                                        'taxonomy' => 'product_categories', 
                                        'field' => 'slug', 
                                        'terms' => 'new_term'
                                        )
                                    )
                                );

Add a custom taxonomy to the page menu of the editor

In my topic, I registered a custom taxonomy and attached it to a custom post type:

// functions.php
function create_custom_post_type() {
    register_taxonomy(
            'tags',
            'projects',
            array(
                'label'                     => 'Tags',
                'rewrite'                   => array('slug' => 'tag'),
                'public'                    => true,
                'hierarchical'          => true,
                'show_ui'               => true,
                'show_admin_column'         => true,
                'show_in_menu'              => true,
                'show_in_rest'              => true,
                'query_var'                 => true,
                'update_count_callback' => '_update_post_term_count',
            )
        );

    register_post_type('pk_projects',
        array(
            'labels' => array(
                'name'              => __('Projects', 'peak'),
                'singular_name'     => __('Project', 'peak'),
                'add_new_item'      => __('Add new project', 'peak'),
                'edit_item'         => __('Edit project', 'peak'),
                'new_item'          => __('New project', 'peak'),
                'view_item'         => __('View project', 'peak')
            ),
            'description' => 'Custom post type for displaying work projects',
            'public' => true,
            'has_archive' => true,
            'hierarchical' => true,
            'menu_icon' => 'dashicons-art',
            'menu_position' => 20,
            'taxonomies' => array('tags'),
            'show_in_menu' => true,
            // 'exclude_from_search' => false,
            // 'publicly_queryable' => true, // set to default value of public
            'rewrite' => array(
                'slug' => __('projects', 'peak'),
                'with_front' => false
            ),
            'show_in_rest' => true,
            'supports' => array(
                'title',
                'editor',
                'author',
                'excerpt',
                'thumbnail',
                'trackbacks',
                'revisions',
                'custom-fields',
                'page-attributes',
                'post-formats'
            )
        )
    );
}
add_action('init', 'create_custom_post_type');

This will successfully add "Project" post types to my topic, and I can add tags from the Projects quick-edit menu. However, I want to be able to add tags from the editor much as categories are added to a post. Example:

Heading of categories in WordPress editor

When I access one of my custom post types, there is no dropdown menu for my custom taxonomy.

Does anyone know how this works? I read the documents for register_post_type and register_taxonomy but could not solve it.

Thanks a lot!

Hash Map – Custom HashMap implementation in Java with linear testing

I tried to implement a HashMap in Java. To deal with collisions, I implemented a kind of LinkedList with a dataNode. I am not very confident about my implementation and ask for feedback.

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class MyHashMap implements SampleMap{

    private double loadFactor;
    private int size;
    private int capacity; // Number of elements in the HashMap
    Set hashSetKeys = new HashSet<>();

    //
    private dataNode() hashTable;

    // Constructor: Default values for instance variables
    public MyHashMap() {
        this(16, 0.75);
    }

    // Constructor: starts with an initialSize for the Map
    public MyHashMap(int initialSize) {
        this(initialSize, 0.75);
    }

    public MyHashMap(int initialSize, double loadFactor) {
        hashTable = new dataNode(initialSize);
        this.size = initialSize;
        this.loadFactor = loadFactor;
    }

    // Removes all the mapping from this map
    @Override
    public void clear() {
        if (size != 0) {
            hashTable = new dataNode(size);
            capacity = 0;
            hashSetKeys.clear();
        }
    }

    public int capacity() {
        return capacity;
    }

    // Returns true if this map contains a mapping for the specified key.
    @Override
    public boolean containsKey(K key) {
        return hashSetKeys.contains(key);
    }

    /*
     * Returns the value to which the specified key is mapped, or null if this
     * map contains no mapping for the key.
     */
    @Override
    public V get(K key) {
        if (this.containsKey(key)) {
            int tableIndex = (key.hashCode() & 0x7fffffff) % (size - 1);
            return get(hashTable(tableIndex), key);
        }
        else {
            // the hashtable does not contain the key
            return null;
        }
    }

    // Helper function for the get method to get the value of a specified key
    private V get(dataNode node, K key) {
        if (node == null) {
            return null;
        }
        else {
            if (node.getKey().equals(key)) {
                return (V) node.getValue();
            }
            else {
                return get(node.getNextNode(), key);
            }
        }
    }

    // Returns the number of key-value mappings in this map
    @Override
    public int size() {
        return this.size;
    }

    /**
     * Associates the specified value with the specified key in this map.
     * If the map previously contained a mapping for the key,
     * the old value is replaced.
     */
    @Override
    public void put(K key, V value) {

        if (((double) capacity / size) >= loadFactor) {
            copyAndIncreaseSize(size);
            this.put(key, value);
        }
        else {
            int tableIndex = (key.hashCode() & 0x7fffffff) % (size - 1);
            if (!hashSetKeys.contains(key)) {
                capacity += 1;
            }
            hashSetKeys.add(key);
            if (hashTable(tableIndex) == null) {
                hashTable(tableIndex) =
                    new dataNode(key, value, key.hashCode());
            }
            else {
                dataNode tempNode = hashTable(tableIndex);
                for (dataNode node : tempNode) {
                    if (node.getKey().equals(key)) {
                        node.setValueData(value);
                        return;
                    }
                }
                hashTable(tableIndex) = new dataNode(key, value,
                    key.hashCode(), hashTable(tableIndex));
            }
        }
    }

    // Helper function to increase the size of the table
    private void copyAndIncreaseSize(int currentSize) {
        dataNode() tempTable = hashTable; // temp table
        hashTable = new dataNode(currentSize * 2); // new hashTable

        this.size = currentSize * 2;  // Updating the size

        // since the hashmap only allows unique keys hence iterating through
        // the keyset
        for (K key : this.keySet()) {
            int currentIndex =
                (key.hashCode() & 0x7fffffff) % (currentSize - 1);

            dataNode tempNode = tempTable(currentIndex);

            // if there is no next node, it is only one node
            if (tempNode != null) {
                if (tempNode.getNextNode() == null) {
                    this.put(key, tempNode.getValue());
                } else {
                    for (dataNode node : tempNode) {
                        if (node.getKey().equals(key)) {
                            this.put(key, tempNode.getValue());
                        }
                    }
                }
            }
        }
    }

    /** Returns a Set view of the keys contained in this map. */
    @Override
    public Set keySet() {
        return hashSetKeys;
    }

    /**
     * Removes the mapping for the specified key from this map if present.
     */
    @Override
    public V remove(K key) {
        throw new UnsupportedOperationException();
    }

    /**
     * Removes the entry for the specified key only if it is currently mapped to
     * the specified value.
     */
    @Override
    public V remove(K key, V value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Iterator iterator() {
        return new HashMapIterator(hashSetKeys);
    }

    private class HashMapIterator implements Iterator {
        K() keyArray;
        int keySetSize;
        int counter = 0;

        HashMapIterator(Set hashKeySet) {
            keyArray = (K()) hashKeySet.toArray();
            keySetSize = hashKeySet.size();
        }

        @Override
        public boolean hasNext() {
            return keySetSize > 0;
        }

        @Override
        public K next() {
            counter += 1;
            size -= 1;
            return keyArray(counter);
        }
    }
}

dataNode.java

import java.util.Iterator;

public class dataNode implements Iterable{

    private int hash;
    private dataNode next;
    private K keyData;
    private V valueData;

    // Constructor for nodes which will store the data
    dataNode(K key, V value, int hash) {
        this.keyData = key;
        this.valueData = value;
        this.hash = hash;
        this.next = null;
    }

    dataNode(K key, V value, int hash, dataNode next) {
        this.keyData = key;
        this.valueData = value;
        this.hash = hash;
        this.next = next;
    }

    // Function to assign the next node
    public void nextNode(dataNode next) {
        this.next = next;
    }

    dataNode getNextNode() {
        return this.next;
    }

    K getKey() {
        return this.keyData;
    }

    V getValue() {
        return this.valueData;
    }

    void setValueData(V valueData) {
        this.valueData = valueData;
    }

    @Override
    public Iterator iterator() {
        return new dataNodeIterator(this);
    }

    private static class dataNodeIterator implements Iterator {
        private dataNode current;

        dataNodeIterator(dataNode node) {
            current = node;
        }

        public boolean hasNext() {
            return current.getNextNode() != null;
        }

        public dataNode next() {
            dataNode nextNode = current.getNextNode();
            current = nextNode;
            return nextNode;
        }
    }
}

Many thanks

Show date as a permalink for custom post type instead of post name

I've created a custom post type and specified a rewrite to change the permalink to / old-donuts /. See code below:

function donut_newsletters_post_type() {

  $labels = array(
    'name' => '🍩 Newsletters',
    'singular_name' => '🍩 Newsletter',
    'add_new' => 'Add 🍩',
    'add_new_item' => 'Add New 🍩',
    'edit_item' => 'Edit 🍩',
    'new_item' => 'New 🍩',
    'view_item' => 'View 🍩',
    'search_item' => 'Search Daily 🍩s',
    'not_found' => 'No 🍩s found',
    'not_found_in_trash' => 'NO 🍩s found in the trash..that would be a sin'
  );
  $args = array(
    'labels' => $labels,
    'public' => true,
    'has_archive' => false,
    'publicly_queryable' => true,
    'query_var' => true,
    'rewrite' => array(
      'slug' => 'old-donuts'
    ),
    'capability_type' => 'post',
    'hierarchical' => false,
    'supports' => array(
      'title',
      'editor',
      'excerpt',
      'thumbnail'
    ),
    'taxonomies' => array('post_tags'),
    'menu_position' => 0,
    'exclude_from_search' => true,
    'menu_icon'   => 'dashicons-email'
  );

  register_post_type('donut_newsletters', $args);
}

add_action('init', 'donut_newsletters_post_type');

Let's say I create a new post and title it "test". By default, the permalink is https://thedonut.co/old-donuts/test

I do not want that. What I do By default, the permalink should have a custom date structure like this by default:

https://thedonut.co/old-donuts/2019-08-24/

I also want the editor to change the permalink so that s / he can change the daily value to the next day if he / she needs to create a post on the day before publication.

Please do not send me a plugin. I've tried a custom plugin for post-type permalinks and it does what I want, but it does not allow you to change the permalink after the post has been posted.

Peepso: Adds an extra data field (custom post meta) to the mailbox

I know that this can be done in the Peepso core, but I want to be able to update the plugin.

I think I found a filter that allows me to edit the mailbox and allow another field. The form is for the activity stream for logged in users. I've found where to add the form, but I need to know how to properly add the date field to the form.

peepso_permissions_post_create

DNS – Use custom domains without specifying A records or name servers

I have a Django website hosted on Heroku, and I want to host a custom domain that was purchased on GoDaddy. Heroku does not provide free A-records or name servers. How should I use my domain name?

I used the Heroku domains: Add to add my custom domain to Heroku, and the provided DNS target for GoDaddy, but I still can not put my website on my domain name.

This is my Heroku Cpanel – Cpanel picture

And that's my GoDaddy DNS Panel – GoDaddy Panel Image

Can anyone tell me what I am doing wrong?

Spring Boot – Error executing UT – BeanCreationException No property update found. Custom repository

While running under UT & # 39; CarRepositoryTest & # 39; the following error is displayed: Is a configuration missing here?

Trigger: org.springframework.beans.factory.BeanCreationException: Error creating bean with name: itemRepository & # 39 ;: call of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create the query for the public abstract void com.dms.repository.interfaces.CustomItemRepository.update (java.util.List) method! No real estate update was found for the type InventoryItemEntity!

Commented with UT with EnableJpaRepositories ((basePackages and repositoryFactoryBeanClass)

@RunWith(SpringRunner.class)
@DataJpaTest
@EnableJpaRepositories(basePackages = {"com.dms.repository",
                                        "com.dms.repository.interface"},
                        repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
@EntityScan(basePackageClasses = Car.class)
public class CarRepositoryTest {
    @Autowired private CarRepository repository;
    @Autowired private TestEntityManager testEntityManager;

    @Test
    public void getCar_returnsCarDetails() throws Exception {
        final String s = GenerateUUID.generateUUID();
        Car savedCar = testEntityManager.persistFlushFind(new Car(s, "hybrid"));
        Car car = this.repository.findByName(s);
        assertNotNull(car);
        assertThat(car.getName(), is(s));
        assertThat(car.getType(), is("hybrid"));
    }
}

@Configuration
@EnableJpaRepositories( basePackages = "com.dms.repository",
                        entityManagerFactoryRef = "entityManagerFactory",
                        transactionManagerRef = "transactionManager",
                        repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
@EnableTransactionManagement
public class JpaConfiguration {
...
}

package com.dms.repository;
@Repository
public class ItemRepositoryImpl implements CustomItemRepository {
    @PersistenceContext
    private EntityManager em;
    @Override
    public void update(List dtos) {
    ...
    }
}

package com.dms.repository.interfaces;
public interface CustomItemRepository {
    void update(List dtos);
}

package com.dms.repository;
public class BaseRepositoryFactoryBean, T,
        I extends Serializable> extends JpaRepositoryFactoryBean {

}

package com.dms.repository;
public class BaseRepositoryImpl extends SimpleJpaRepository implements BaseRepository {
    private final EntityManager em;
    @Transactional
    @Override
    public Specification searchUsingRSQLParser(String query) {
        return new RSQLParser().parse(query)
                .accept(new CustomRsqlVisitor<>());
    }
}

Which configuration should be added / changed so that UT does not fail with a custom repository?

Custom Speed ​​Dial for Post Types – WordPress Development Stack Exchange

I'm creating a custom post type (features) in my design using advanced custom field plugins. I want to know how to create shortcodes for my custom post type. so I just used a short code of this custom post type of any page to display information that I added in my custom post type (features).

This is my code:

    
'features',); $feature_query = new WP_Query( $feature ); if(have_posts() ) : while($feature_query->have_posts() ) : $feature_query->the_post(); ?>