Can you link custom post types to pages?

The reason i ask is because when i create pages they don't insert the usual name of the post type like CPT's do. For example if i create a page called toyota the URL would be http://domain.com/toyota, but if i created a custom post type to Enter all the makes one page with custom links to specific pages within my site and say that CPT was called Cars then the URL would look like this http://domain.com/cars/toyota and therefore wouldn't properly …
Category: Web

Link section within page with slash (/) and not hash (#) without reloading the page

So here is a requirement: Client wants a page template where there is two level menu on left side of the page. That menu can link to any page, post, category or a section within same page. The menu which links to a section within same page should be slash linked and not # linked for the purpose of SEO. And this is how we have implemented it: Based on one requirement I have developed a custom page template with …
Category: Web

How to add a link in a image's caption?

I would like to add a link to the caption of a photo in one of my posts. I can type in the HTML for the link in the caption, but when I publish the post the link gets removed. How do you add a link to a caption? This would be really useful for giving photo credit.
Category: Web

Ignore posts content in the posts queries for internal linking

I am looking for a filter to ignore searching in posts content from the posts editor which is natively using the link function. https://developer.wordpress.org/reference/classes/_wp_editors/wp_link_query/ Use case: with 300,000 articles, the query is too slow, searching in titles and excerpt is good enough. Internal linking happens in the Classic Editor; example below: Action: /wp-admin/admin-ajax.php Form Data: action: wp-link-ajax page: 1 search: Hello world Thank you, UPDATE: I changed in class-wp-query.php the line: $search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op …
Category: Web

Eliminate errors in internal linking

Situation: based on url mywebsite.com/products/company/product-name/ I discovered that I can create a url mywebsite.com/products/WHATEVER/product-name/ and it will still work and display that page, which, unlike 404, is worse. Need: elimination of such a technical possibility (eliminating such links in internal linking) Thanks in advantage
Category: Web

How to use Shortcode from one WordPress page in another WordPress page?

Is there a way to use a shortcode that works in one WordPress page in another completely separate WordPress page? Like if the shortcode was just a link, I could just use a href on the other page, but it's a shortcode [xxx] that needs to execute on the 1st Wordpress page that I want to display on another completely separate Wordpress page if that makes sense?
Category: Web

Linking images in WordPress Paginated Post

I have a paginated post on WordPress with about 5 pages. I want to set it up so that the images in the content from the previous page automatically link to the following page. I've used the following code in functions.php file: <?php add_action('the_content',function($content) { global $page, $numpages, $multipage; if ( $multipage ) { $nextPage = $page + 1; if ( $nextPage <= $numpages ) { $link = _wp_link_page( $nextPage ); $content = preg_replace('/(<img(.+?)\/>)/i','<a href="'.$link.'">$1</a>', $content); } } // send …
Category: Web

Getting out side of wp root folder from function.php using absolute path

Hi Everyone I am having a relative path issue with linking a css file using a absolute path. Basically I am having the exact same problem as the person here however I do not want to use the URL of the site to link the css file. Anything I do, word press tries to put its own file path in front of it. so if i have done this: wp_enqueue_style('media', $_SERVER["DOCUMENT_ROOT"] . '/assets/css/media.css'); word press will give me this : …
Category: Web

Linking three taxonomies with ACF

I'm creating a product finder using a CPT called "Products", which is already used for displaying products separately on the site. The product finder is based on a answer and question idea, where the user is presented with a list of product categories (within a taxonomy called: "Categories"). When the user clicks on of the categories, they then get presented with a question, which can have multiple answers. So, for example, the user clicks on the category: "Mattress" and then …
Category: Web

Silo Structure; Will links from home page to a Sub-category or Post undermine silo seo advantage?

I have a question about the Silo structure that I was hoping someone might be able to help me. I am building a four tier silo site: TIER 1 ... Home page TIER 2 ... Categories TIER 3 ... Sub-categories TIER 4 ... Wordpress blog posts I understand from Bruce Clay's explanation of the silo structure, TIER 4 pages boost the Google keyword ranking of the TIER 3 pages, and TIER 3 & 4 pages combined - boost the Google …
Category: Web

Assets in css dont link properly in pages other than home

Hello I have a small issue regarding my linking in my style.css For example: @font-face { src: url('wp-content/themes/mytheme/fonts/font.ttf'); } and .div { background: url('wp-content/themes/mytheme/images/img.png'); } My home page works perfectly, assets link correctly but when I go to another page such as "about" the links are broken because it does this: www.url.com/about/wp-content/themes/mytheme/images/img.png Anyone know why this is happening? Thanks
Category: Web

Internal Links that Automatically Update

I am currently building out a big site with a lot of content right now and am struggling with an aspect of internal linking. I had assumed I'd find lots of people with the same issue, however as I can't easily find a plugin to do what I need, It seems not! A simple example is with a contact us page. I've given it the URL slug /contact-us/. When I link to this page from elsewhere in the content the …
Category: Web

Remote install won't find Parent theme when intalling Child Theme, but local install does

On my localhost wordpress install I am using a Parent Theme called "Tesseract", and a Child Theme called "Tesseract-child". Now, I want to deploy my code on a remote WP install and, for some unknown reasons, I am running into problems. On the remote install, the Parent Theme, "Tesseract", installs fine and is listed among the installed themes as it should be. However, when installing the .zip file of my Child Theme, "Tesseract-child", I get this series of messages: Unpacking …
Category: Web

Changing 'Add to cart' button text and relink for some specific products

I want to make custom button for some products in place of add to cart button on shop page and set dynamic relinking to some other page. So I made a checkbox at the product page and if that checkbox is enabled then the custom button with different link will be visible to that product. here is the code for checkbox: add_action( 'add_meta_boxes', 'wdm_add_meta_box' ); add_action( 'add_meta_boxes', 'wdm_add_customize_enable_metabox' ); function wdm_add_customize_enable_metabox() { add_meta_box( 'Checkbox_metabox', 'Check if you want to enable …
Category: Web

Creating custom post type posts and associating them with a post from another custom post type

I've created two custom post types -- one for Activities and one for Places. Any post under Activities needs to be associated with a Places and I was wondering what the best approach would be in order to accomplish this. Ideally, I could create a new Place and use the Post Title when adding the new Activity post, but am not sure how to do this or if it's even possible. Can this be done? If not, would it be …
Category: Web

Linking Javascript in functions.php file

Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct syntax using the wp_enqueue_script function. <script src="../assets/components/plugins/ajaxify/script.min.js?v=v1.9.6&sv=v0.0.1"></script> <script>var App = {};</script> <script data-id="App.Scripts"> App.Scripts = { /* CORE scripts always load first; */ core: [ '../assets/components/library/jquery/jquery.min.js?v=v1.9.6&sv=v0.0.1', '../assets/components/library/modernizr/modernizr.js?v=v1.9.6&sv=v0.0.1' ], /* PLUGINS_DEPENDENCY always load after CORE but before PLUGINS; */ plugins_dependency: [ '../assets/components/library/bootstrap/js/bootstrap.min.js?v=v1.9.6&sv=v0.0.1', '../assets/components/library/jquery/jquery-migrate.min.js?v=v1.9.6&sv=v0.0.1' ], /* PLUGINS …
Category: Web

How do I display image files as links?

I'm a WP newbie and need some help. I have about 5000 images to upload to my site and need to link each one with a specific entry in a list. The thought of going through 5000 entries (it's a plant species database) and linking each one individually to an image fills me with dread, so I was wondering if there is a way of (or plugin for) displaying an image as linked text? Basically I want to batch highlight …
Category: Web

How do I link an image in my plugin so it displays on WordPress?

I'm creating a plugin for a college project. The plugin is very simple: it searches for name of the site address and upon finding it in a post, it outputs the site address with an image. However, I cannot get the code working. I've tried this: <?php /* Plugin Name: Murtaghs Trademark Plugin Plugin URI: http://www.MurtaghsPub&Undertakers.ie Description: Adds Murtaghs Logo Wherever name Of Business Displayed On Page. Author: Connell Gray Version: 1.0 Author URI: http://www.MurtaghsPub&Undertakers.ie */ function Murtaghs_Trademark_Plugin($text) { $site_name …
Category: Web

Problem with guids and absolute links

Post and page guids include the full absolute URL of my site (e.g. http://www.example.com/wordpress/?p=1). This causes a problem if the domain, or wordpress path changes, or if I'm viewing the site via its IP address rather its domain, etc. Problem 1: there are some internal links on my site that are using the guid. I'm guessing this is wrong and I should rewrite the template code to remove references to the guid - correct? Problem 2: images are inserted into …
Category: Web

How to add a credit line to a photo caption

I'm trying to find a way to automatically add a photographer credit line to user-inserted photos. I've added custom fields to the media uploader for 'Photographer Name' and 'Photographer URL' but I can't figure out a way to automatically insert the input from these fields into the caption field so that they will automatically display with the photo. Here's the code to generate the custom fields: function attachment_field_credit( $form_fields, $post ) { $form_fields['photographer-name'] = array( 'label' => 'Photographer Name', 'input' …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.