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.

permalinks – How to add a sub directory to WordPress single posts without affecting other post types?

I’ve been trying to add a subdirectory to my blog post’s permalink for example domain.com/blog/post-slug/

However, this is affecting the other post types that I’ve created using Pods such as domain.com/knowledgebase/ is now domain.com/blog/knowledgebase/

I would appreciate anyone helping me solve this problem. I still just want a blog as a subdirectory for my posts but I need the other post types not affected by that change.

Từ khóa lên rất nhanh sau khi post bài nhưng lại mất hút






Chào các bạn!
web mình đăng bài sau 1h được index, kiểm tra từ khóa trên google thì top 1 (tự động lên) nhưng khi ngủ qua ngày thì lọt qua trang 2. Mình có rất nhiều trường hợp, khi mới đăng bài thì từ khóa up rất nhanh sau đó bị mất tiêu điểm khi qua trang 2 trang 3. Xin hỏi các nhân sự của bạn vì sao từ khóa lên nhanh trong giai đoạn đầu, sau đó giảm rất thảm. Mình không đi spam hay đặt quá nhiều textlink. Cảm ơn !
p / s: Từ khóa có mức độ dễ seo, không quá khó, cho lưu lượng cao, không phạm vi từ cấm khóa, không phải từ cảm biến khóa

https://bephongngoaidon.com/

.(tagsToTranslate)webmaster forum(t)internet marketing(t)search engine optimization(t)web designing(t)seo(t)ppc(t)affiliate marketing(t)search engine marketing(t)web hosting(t)domain name(t)social media

Buying – Get Paid to Post Businesses to New Directory

I am looking for someone to post actual businesses to a new cannabis business directory. This would require Googling businesses and entering the details of the business to the directory including business name, description, address, hours and 1 image.

I will pay $10 for every 25 satisfactory listings submitted. This will only be available to the first 5 or so members to respond.

Please post here or PM for the directory URL. I will post here when the opportunity is closed. Thanks!
SEMrush

 

java – Estou tentando fazer uma requisição POST, porém o postman está me retornando um erro. Me ajudem!

// Controlador

insira o código aqui

package Controlador;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import RecebaInformacoes.SistemaInf;
import Repositorio.SaveEntidade;

@RestController //definir um controlador REST
public class Controller {
@Autowired private SaveEntidade entidade;

    @PostMapping(value = "/teste", consumes = MediaType.APPLICATION_XML_VALUE ) 
    public String processar(@RequestBody SistemaInf information) {
        entidade.save(information);
        
        
        return "Nice Men";
    }

}

RESPOSTA POSTMAN

{“timestamp”:”2020-10-19T14:05:39.423+00:00″,”status”:404,”error”:”Not Found”,”message”:”No message available”,”path”:”/teste”}

Write & Publish TOP 5 Guest Posts DA80+ DoFoIIow Links for $30

Write & Publish TOP 5 Guest Posts DA80+ DoFoIIow Links

For the last 5 years, I’m working as a Digital Marketing seller and in this post, I’ll explain my TOP 5 dofollow Guest Posting service details.

I will write [well-researched, plagiarism-free, SEO-friendly] article and publish Guest Posts on high authority dofollow websites DA 80+ with permanent backlinks to your website to feature more program value.

This Guest Post may be a great opportunity for you. This Guest Post-service provides you the top quality, natural links that can surely assist you to spice up keyword ranking on search engines and obtain more traffic.

Website S.E.O Metrics:
Diigo.com – DA 89 & DR 85
Evernote.com – DA 92 & DR 91
Telegra.ph -DA 88 & DR 83
Ko-fi.com – DA 70 & DR 88
Pearltrees.com -DA 86 & DR 85
Link Type: DoFollow

What I will provide:
5 High Authority Dofollow Guest posts with DA80+
5 Unique 500 – 1000 words articles based on your website niche & keywords
Keyword Rich well-researched, plagiarism-free, SEO-friendly article.

You will receive an exact report with all the links where your blog posts are posted

Quick delivery.

100% satisfaction guaranteed.

Please Note:

  • I don’t accept all URLs except gambling, dating, adult, and pharmacy.
  • Permanent posts with DOFOLLOW backlinks.
  • I guarantee high-quality content.
  • No cheap article spinning or duplicate content.

If you have any questions about this service, please feel free to contact me.

Thank You!

.

SharePoint Designer 2013 Workflow HTTP Web Service on POST: Error – The given key was not present in the dictionary

Thank you for reading this. This is a bit long, but I’m trying to be as detailed as possible. Any help would be greatly appreciated. If more info is needed, please let me know. As info, I am not a (JavaScript) developer. I’ve been tasked to do as many things as possible OOTB.

Environment: SharePoint Online and SharePoint Designer 2013 (for workflows).

Scenario: Have a Team Site and a Subsite to it. When an item is added to a Custom List in the Subsite, the workflow is to find the matching task in the Task List on the Parent Site and mark the Task Status as “Completed”. (A variable is created in the workflow to match the item added to the list with the task.)

Success: Using the HTTP Web Service action to GET Task items via the Workflow. Evidenced by logging the response in a custom list using Create Item in List workflow action.

Issue: Using POST to add or update a Task to the task list. Continue to get the error {“error”:{“code”:”-1, System.Collections.Generic.KeyNotFoundException”,”message”:{“lang”:”en-US”,”value”:”The given key was not present in the dictionary.”}}}

Pre-conditions: Because we were going between site and subsite, we followed the articles to create elevated workflow permissions for use of the App Step. Did this on both the site and subsite. https://msdn.microsoft.com/en-us/library/office/jj822159.aspx, http://www.fabiangwilliams.com/2014/06/19/gotcha-on-sharepoint-designer-workflows-in-app-step/

Because this error seems to sometimes be illusive, decided to create the workflow on lists within the same Team Site to remove any possibility of authorization issue. Therefore the example shown below is not using APP Steps.

Trouble-shooting: Used Fiddler with Chrome to walk through and did not receive any errors. https://cann0nf0dder.wordpress.com/2016/09/12/getting-fiddler-to-work-with-sharepoint-online/. Viewed many, many articles also.

Workflow:

  1. Hard-coded a Variable = TempMatchString to match with a value in the Task List to bring back specific Task(s). Ignore first two lines of the workflow – will be used once the issue is resolved.

enter image description here

  1. Get Matching Task(s)

    • Build GET_RequestHeader Dictionary.
      Accept = application/json;odata=verbose as String and
      Content-Type = application/json;odata=verbose as String

    • Perform the GET HTTP Web Service request with URL: https://mycompany.sharepoint.com/HumanResourcesTS/_api/web/lists/getByTitle('ProgressReportTasks')/Items?$filter=(Title eq (%Variable:TempMatchString%)

    • Create Item in the SPListGETContent list to view the response.

    • Store the array returned in Variable “ListDataSet”. Note: I am using Get valueinstead of d/results. If I do the GET Call from the subsite I get the JSON returned with d/results as seen in most all articles online, but value when used on the parent site. I am not sure why this differs.

    • Count to number of items returned.
      enter image description here
  2. Get FormDigestValue

Read several articles stating need to set the X-RequestDigest to the FormDigestValue to POST.

Thank you!!

how to prefill post content

I got a button which will appear in all posts. I used this snippet (for testing) in the functions.php but it has no effect.

    
    add_filter( 'default_title', function() {
        return 'My default title';
    });

    add_filter( 'default_content', function() {
        return 'My default content';
    });

    add_filter( 'default_excerpt', function() {
        return 'My default excerpt';
    });

[Liam W] (RIP) Post Count Rebuild

AnimeHaxor submitted a new resource:

Post Count Rebuild – Correct those post counts!

This is a simple add-on that adds a rebuilder to the ‘Rebuild caches’ page to rebuild your boards users message counts.

This takes into account whether or not the forum counts posts to the post count.

Read more about this…

Read more